gluonts.evaluation.metrics module

gluonts.evaluation.metrics.abs_error(target: numpy.ndarray, forecast: numpy.ndarray) → float[source]
\[abs\_error = sum(|Y - \hat{Y}|)\]
gluonts.evaluation.metrics.abs_target_mean(target) → float[source]
\[abs\_target\_mean = mean(|Y|)\]
gluonts.evaluation.metrics.abs_target_sum(target) → float[source]
\[abs\_target\_sum = sum(|Y|)\]
gluonts.evaluation.metrics.calculate_seasonal_error(past_data: numpy.ndarray, forecast: gluonts.model.forecast.Forecast, seasonality: Optional[int] = None)[source]
\[seasonal\_error = mean(|Y[t] - Y[t-m]|)\]

where m is the seasonal frequency. See [HA21] for more details.

gluonts.evaluation.metrics.coverage(target: numpy.ndarray, forecast: numpy.ndarray) → float[source]
\[coverage = mean(Y < \hat{Y})\]
gluonts.evaluation.metrics.mape(target: numpy.ndarray, forecast: numpy.ndarray) → float[source]
\[mape = mean(|Y - \hat{Y}| / |Y|))\]

See [HA21] for more details.

gluonts.evaluation.metrics.mase(target: numpy.ndarray, forecast: numpy.ndarray, seasonal_error: float) → float[source]
\[mase = mean(|Y - \hat{Y}|) / seasonal\_error\]

See [HA21] for more details.

gluonts.evaluation.metrics.mse(target: numpy.ndarray, forecast: numpy.ndarray) → float[source]
\[mse = mean((Y - \hat{Y})^2)\]

See [HA21] for more details.

gluonts.evaluation.metrics.msis(target: numpy.ndarray, lower_quantile: numpy.ndarray, upper_quantile: numpy.ndarray, seasonal_error: float, alpha: float) → float[source]
\[msis = mean(U - L + 2/alpha * (L-Y) * I[Y<L] + 2/alpha * (Y-U) * I[Y>U]) / seasonal\_error\]

See [SSA20] for more details.

gluonts.evaluation.metrics.owa(target: numpy.ndarray, forecast: numpy.ndarray, past_data: numpy.ndarray, seasonal_error: float, start_date: pandas._libs.tslibs.timestamps.Timestamp) → float[source]
\[owa = 0.5*(smape / smape\_naive + mase / mase\_naive)\]

See [SSA20] for more details.

gluonts.evaluation.metrics.quantile_loss(target: numpy.ndarray, forecast: numpy.ndarray, q: float) → float[source]
\[quantile\_loss = 2 * sum(|(Y - \hat{Y}) * (Y <= \hat{Y}) - q|)\]
gluonts.evaluation.metrics.smape(target: numpy.ndarray, forecast: numpy.ndarray) → float[source]
\[smape = 2 * mean(|Y - \hat{Y}| / (|Y| + |\hat{Y}|))\]

See [HA21] for more details.