RMSE#

class pytorch_forecasting.metrics.point.RMSE(reduction='sqrt-mean', **kwargs)[source]#

Bases: MultiHorizonMetric

Root mean square error.

Defined as sqrt(mean((y_pred - target)**2)).

Note: The square root is applied during the reduction step via the sqrt-mean strategy, while the loss method calculates the squared error.

Initialize metric

Parameters:
  • name (str) – metric name. Defaults to class name.

  • quantiles (List[float], optional) – quantiles for probability range. Defaults to None.

  • reduction (str, optional) – Reduction, “none”, “mean” or “sqrt-mean”. Defaults to “mean”.

Methods

loss(y_pred, target)

Calculate loss without reduction.

loss(y_pred: dict[str, Tensor], target: Tensor) Tensor[source]#

Calculate loss without reduction. Override in derived classes

Parameters:
  • y_pred – network output

  • target – actual values

Returns:

loss/metric as a single number for backpropagation

Return type:

torch.Tensor