Saltar al contenido principal

MAPE

Metric
DashAI.back.metrics.regression.MAPE

Average error as a percentage of the true value.

Mean Absolute Percentage Error expresses each error relative to the value it missed, so a forecast can be judged without knowing the scale of the series. That is what makes it the usual way to compare a forecast across products, regions or periods whose magnitudes differ by orders of magnitude, where an absolute error in units says nothing on its own.

::

MAPE(y, y') = 100 / N · sum |yi - y'i| / |yi|

Range: [0, +inf), lower is better.

The formula divides by the true value, so it is undefined wherever that value is zero, and then the whole score is undefined: averaging only the other rows would report the error of a different series, and an infinity says nothing. It raises UndefinedMetricError, which a run records as "not available" with the reason. Prefer :class:SMAPE on series that reach zero.

MAPE is also asymmetric: it penalises a forecast that is too high more heavily than one that is too low by the same amount, since the denominator stays fixed while the error does not.

References​

Methods​

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

Defined on MAPE

Calculate the MAPE 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
MAPE as a percentage.

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

score_forecast(cls, forecast: DashAI.back.metrics.forecasting_metric.ScoredForecast) -> float

Defined on PointMetricMixin

The metric's score on the actual values and the point forecast.

Compatible with​