Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMSE defined as MSE #1541

Open
jenkoj opened this issue Mar 14, 2024 · 1 comment
Open

RMSE defined as MSE #1541

jenkoj opened this issue Mar 14, 2024 · 1 comment

Comments

@jenkoj
Copy link

jenkoj commented Mar 14, 2024

Noticed discrepancy related to metric definition. RMSE is actually MSE, which makes sense as RMSE tends to be very unstable.

Definiton:

class RMSE(MultiHorizonMetric):
  """
  Root mean square error
  
  Defined as ``(y_pred - target)**2``
  """
  
  def __init__(self, reduction="sqrt-mean", **kwargs):
   super().__init__(reduction=reduction, **kwargs)
  
  def loss(self, y_pred: Dict[str, torch.Tensor], target):
    loss = torch.pow(self.to_prediction(y_pred) - target, 2)
    return loss

source:
https://github.com/jdb78/pytorch-forecasting/blob/68a0eb5f1701801142ce976fa50305b29507845a/pytorch_forecasting/metrics/point.py#L137C1-L149C20

@AlexVeuthey
Copy link

The documentation isn't very clear, but I believe the root is applied by the reduction function, thus making it RMSE. A bit risky since the reduction function doesn't have to be "sqrt-mean"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants