Use this file to discover all available pages before exploring further.
The most important train signal is the forecast error, which is the
difference between the observed value yτ and the prediction
y^τ, at time yτ:eτ=yτ−y^ττ∈{t+1,…,t+H}The train loss summarizes the forecast errors in different evaluation
metrics.
Mean Absolute Error (MAE)MAE measures the relative prediction
accuracy of a forecasting method by calculating the
deviation of the prediction and the true
value at a given time and averages these devations
over the length of the series.
Mean Squared Error (MSE)MSE measures the relative prediction
accuracy of a forecasting method by calculating the
squared deviation of the prediction and the true
value at a given time, and averages these devations
over the length of the series.
Root Mean Squared Error (RMSE)RMSE measures the relative prediction
accuracy of a forecasting method by calculating the squared deviation
of the prediction and the observed value at a given time and
averages these devations over the length of the series.
Finally the RMSE will be in the same scale
as the original time series so its comparison with other
series is possible only if they share a common scale.
RMSE has a direct connection to the L2 norm.
Compute the raw Absolute Periods In Stock (PIS) for one or multiple models.The PIS metric sums the absolute forecast errors per series without any scaling,
yielding a scale-dependent measure of bias.
Mean Absolute Percentage Error (MAPE)MAPE measures the relative prediction
accuracy of a forecasting method by calculating the percentual deviation
of the prediction and the observed value at a given time and
averages these devations over the length of the series.
The closer to zero an observed value is, the higher penalty MAPE loss
assigns to the corresponding error.
Symmetric Mean Absolute Percentage Error (SMAPE)SMAPE measures the relative prediction
accuracy of a forecasting method by calculating the relative deviation
of the prediction and the observed value scaled by the sum of the
absolute values for the prediction and observed value at a
given time, then averages these devations over the length
of the series. This allows the SMAPE to have bounds between
0% and 100% which is desirable compared to normal MAPE that
may be undetermined when the target is zero.
Mean Absolute Scaled Error (MASE)MASE measures the relative prediction
accuracy of a forecasting method by comparinng the mean absolute errors
of the prediction and the observed value against the mean
absolute errors of the seasonal naive model.
The MASE partially composed the Overall Weighted Average (OWA),
used in the M4 Competition.Parameters:
Relative Mean Absolute Error (RMAE)Calculates the RAME between two sets of forecasts (from two different forecasting methods).
A number smaller than one implies that the forecast in the
numerator is better than the forecast in the denominator.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
Normalized Deviation (ND)ND measures the relative prediction
accuracy of a forecasting method by calculating the
sum of the absolute deviation of the prediction and the true
value at a given time and dividing it by the sum of the absolute
value of the ground truth.
Mean Squared Scaled Error (MSSE)MSSE measures the relative prediction
accuracy of a forecasting method by comparinng the mean squared errors
of the prediction and the observed value against the mean
squared errors of the seasonal naive model.Parameters:
Root Mean Squared Scaled Error (RMSSE)MSSE measures the relative prediction
accuracy of a forecasting method by comparinng the mean squared errors
of the prediction and the observed value against the mean
squared errors of the seasonal naive model.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, actuals and predictions.
required
models
list of str
Columns that identify the models predictions.
required
seasonality
int
Main frequency of the time series; Hourly 24, Daily 7, Weekly 52, Monthly 12, Quarterly 4, Yearly 1.
required
train_df
pandas or polars DataFrame
Training dataframe with id and actual values. Must be sorted by time.
required
id_col
str
Column that identifies each serie. Defaults to ‘unique_id’.
required
target_col
str
Column that contains the target. Defaults to ‘y’.
required
cutoff_col
str
Column that identifies the cutoff point for each forecast cross-validation fold. Defaults to ‘cutoff’.
required
Returns:
Type
Description
pandas or polars DataFrame: dataframe with one row per id and one column per model.
Compute the scaled Absolute Periods In Stock (sAPIS) for one or multiple models.The sPIS metric scales the sum of absolute forecast errors by the mean in-sample demand,
yielding a scale-independent bias measure that can be aggregated across series.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, actuals and predictions.
required
models
list of str
Columns that identify the models predictions.
required
train_df
pandas or polars DataFrame
Training dataframe with id and actual values. Must be sorted by time.
Quantile Loss (QL)QL measures the deviation of a quantile forecast.
By weighting the absolute deviation in a non symmetric way, the
loss pays more attention to under or over estimation.
A common value for q is 0.5 for the deviation from the median.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
required
models
dict from str to str
Mapping from model name to the model predictions for the specified quantile.
Scaled Quantile Loss (SQL)SQL measures the deviation of a quantile forecast scaled by
the mean absolute errors of the seasonal naive model.
By weighting the absolute deviation in a non symmetric way, the
loss pays more attention to under or over estimation.
A common value for q is 0.5 for the deviation from the median.
This was the official measure used in the M5 Uncertainty competition
with seasonality = 1.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
required
models
dict from str to str
Mapping from model name to the model predictions for the specified quantile.
Multi-Quantile loss (MQL)MQL calculates the average multi-quantile Loss for
a given set of quantiles, based on the absolute
difference between predicted quantiles and observed values.The limit behavior of MQL allows to measure the accuracy
of a full predictive distribution with
the continuous ranked probability score (CRPS). This can be achieved
through a numerical integration technique, that discretizes the quantiles
and treats the CRPS integral with a left Riemann approximation, averaging over
uniformly distanced quantiles.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
required
models
dict from str to list of str
Mapping from model name to the model predictions for each quantile.
Scaled Multi-Quantile loss (SMQL)SMQL calculates the average multi-quantile Loss for
a given set of quantiles, based on the absolute
difference between predicted quantiles and observed values
scaled by the mean absolute errors of the seasonal naive model.
The limit behavior of MQL allows to measure the accuracy
of a full predictive distribution with
the continuous ranked probability score (CRPS). This can be achieved
through a numerical integration technique, that discretizes the quantiles
and treats the CRPS integral with a left Riemann approximation, averaging over
uniformly distanced quantiles.
This was the official measure used in the M5 Uncertainty competition
with seasonality = 1.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
required
models
dict from str to list of str
Mapping from model name to the model predictions for each quantile.
Scaled Continues Ranked Probability ScoreCalculates a scaled variation of the CRPS, as proposed by Rangapuram (2021),
to measure the accuracy of predicted quantiles y_hat compared to the observation y.
This metric averages percentual weighted absolute deviations as
defined by the quantile losses.Parameters:
Name
Type
Description
Default
df
pandas or polars DataFrame
Input dataframe with id, times, actuals and predictions.
required
models
dict from str to list of str
Mapping from model name to the model predictions for each quantile.
For a set of forecasts {μi}i=1N and observations
{yi}i=1N, the mean Tweedie deviance with power p isTDp(μ,y)=N1i=1∑Ndp(yi,μi)where the unit-scaled deviance for each pair (y,μ) isdp(y,μ)=2⎩⎨⎧(1−p)(2−p)y2−p−1−pyμ1−p+2−pμ2−p,ylnμy−(y−μ),−2[lnμy−μy−μ],p∈/{1,2},p=1(Poisson deviance),p=2(Gamma deviance).
yi are the true values, μi the predicted means.
p controls the variance relationship
Var(Y)∝μp.
When 1<p<2, this smoothly interpolates between Poisson (p=1) and
Gamma (p=2) deviance.
Compute the Tweedie deviance loss for one or multiple models, grouped by an identifier.Each group’s deviance is calculated using the mean_tweedie_deviance function, which
measures the deviation between actual and predicted values under the Tweedie distribution.The power parameter defines the specific compound distribution: