sktime.performance_metrics.forecasting

class sktime.performance_metrics.forecasting.MASE[source]

Bases: sktime.performance_metrics.forecasting._classes.MetricFunctionWrapper

sktime.performance_metrics.forecasting.make_forecasting_scorer(fn, name=None, greater_is_better=False)[source]

Factory method for creating metric classes from metric functions

sktime.performance_metrics.forecasting.mape_loss(y_test, y_pred)[source]
Mean absolute percentage error (MAPE)

MAPE output is non-negative floating point where the best value is 0.0. There is no limit on how large the error can be, particulalrly when y_test values are close to zero. In such cases the function returns a large value instead of inf.

Parameters
  • y_test (pandas Series of shape = (fh,) where fh is the forecasting horizon) – Ground truth (correct) target values.

  • y_pred (pandas Series of shape = (fh,)) – Estimated target values.

Returns

loss – MAPE loss expressed as a fractional number rather than percentage point.

Return type

float

Examples

>>> from sklearn.metrics import mean_absolute_error
>>> y_test = pd.Series([1, -1, 2])
>>> y_pred = pd.Series([2, -2, 4])
>>> mape_loss(y_test, y_pred)
1.0
sktime.performance_metrics.forecasting.mase_loss(y_test, y_pred, y_train, sp=1)[source]

Mean absolute scaled error.

This scale-free error metric can be used to compare forecast methods on a single series and also to compare forecast accuracy between series. This metric is well suited to intermittent-demand series because it never gives infinite or undefined values.

Parameters
  • y_test (pandas Series of shape = (fh,) where fh is the forecasting horizon) – Ground truth (correct) target values.

  • y_pred (pandas Series of shape = (fh,)) – Estimated target values.

  • y_train (pandas Series of shape = (n_obs,)) – Observed training values.

  • sp (int) – Seasonal periodicity of training data.

Returns

loss – MASE loss

Return type

float

References

..[1] Hyndman, R. J. (2006). “Another look at measures of forecast

accuracy”, Foresight, Issue 4.

class sktime.performance_metrics.forecasting.sMAPE[source]

Bases: sktime.performance_metrics.forecasting._classes.MetricFunctionWrapper

sktime.performance_metrics.forecasting.smape_loss(y_test, y_pred)[source]

Symmetric mean absolute percentage error

Parameters
  • y_test (pandas Series of shape = (fh,) where fh is the forecasting horizon) – Ground truth (correct) target values.

  • y_pred (pandas Series of shape = (fh,)) – Estimated target values.

Returns

loss – sMAPE loss

Return type

float