Skip to main content

SMAPE

Metric
DashAI.back.metrics.forecasting.SMAPE

Percentage error measured against the size of both values.

Symmetric Mean Absolute Percentage Error divides each error by the average of the true and predicted values rather than by the true value alone. That small change fixes the two things that make :class:MAPE awkward on real series: it stays defined when the truth is zero, and it does not punish over-forecasting more harshly than under-forecasting.

::

sMAPE(y, y') = 100 / N · sum 2 |yi - y'i| / (|yi| + |y'i|)

Range: [0, 200], lower is better. The ceiling is reached when a value and its forecast have nothing in common, for example predicting a non-zero number where the truth is zero, which is exactly the case MAPE cannot score at all.

A row where the true value and the forecast are both zero is counted as no error rather than as an undefined ratio, since a forecast of nothing that turned out to be nothing is right.

References

Methods

score(true_values: 'DashAIDataset', pred_values: 'np.ndarray') -> float

Defined on SMAPE

Calculate the sMAPE between true values and predicted values.

Parameters

true_values : DashAIDataset
A DashAI dataset with true values.
pred_values : np.ndarray
A one-dimensional array with the predicted values for each instance.

Returns

float
sMAPE as a percentage between 0 and 200.

get_metadata(cls: 'BaseMetric') -> Dict[str, Any]

Defined on BaseMetric

Get metadata values for the current metric.

Returns

Dict[str, Any]
Dictionary with the metadata

Compatible with