Lably
Skip to content

Mean absolute percentage error

  • 4 min read
  • 3 chapters

Related on Lably

Through Statistics and Regression analysis

MAPE=1001n∑t=1n|At−FtAt|

where At is the actual value and Ft is the forecast value. Their difference is divided by the actual value At. The absolute value of this ratio is summed for every forecasted point in time and divided by the number of fitted points n.

MAPE in regression problems

Mean absolute percentage error is commonly used as a loss function for regression problems and in model evaluation, because of its very intuitive interpretation in terms of relative error.

Definition

Consider a standard regression setting in which the data are fully described by a random pair Z=(X,Y) with values in Rd×R, and n i.i.d. copies (X1,Y1),...,(Xn,Yn) of (X,Y). Regression models aim at finding a good model for the pair, that is a measurable function g from Rd to R such that g(X) is close to Y.

In the classical regression setting, the closeness of g(X) to Y is measured via the L2 risk, also called the mean squared error (MSE). In the MAPE regression context, the closeness of g(X) to Y is measured via the MAPE, and the aim of MAPE regressions is to find a model gMAPE such that:

gMAPE(x)=arg⁡ming∈GE[|g(X)−YY||X=x]

where G is the class of models considered (e.g. linear models).

In practice

In practice gMAPE(x) can be estimated by the empirical risk minimization strategy, leading to

g^MAPE(x)=arg⁡ming∈G∑i=1n|g(Xi)−YiYi|

From a practical point of view, the use of the MAPE as a quality function for regression model is equivalent to doing weighted mean absolute error (MAE) regression, also known as quantile regression. This property is trivial since

g^MAPE(x)=arg⁡ming∈G∑i=1nω(Yi)|g(Xi)−Yi| with ω(Yi)=|1Yi|

As a consequence, the use of the MAPE is very easy in practice, for example using existing libraries for quantile regression allowing weights.

Consistency

The use of the MAPE as a loss function for regression analysis is feasible both on a practical point of view and on a theoretical one, since the existence of an optimal model and the consistency of the empirical risk minimization can be proved.

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Energy