MAPE
May 20, 2023
MAPE, or Mean Absolute Percentage Error, is a commonly used metric for evaluating the accuracy of machine learning models. It is particularly useful for measuring the performance of models that make predictions on continuous data, such as stock prices, weather forecasts, or revenue projections.
Definition
The formula for MAPE is as follows:
\(\)$$MAPE = (1/n) * ∑(i=1 to n) |(Actual – Predicted)/Actual|$$
(1/n) * ∑(i=1 to n) |(Actual – Predicted)/Actual|
where n
is the total number of observations, Actual
is the actual value of the target variable, and Predicted
is the predicted value of the target variable.
MAPE is expressed as a percentage, and it represents the average percentage difference between the actual and predicted values. A lower MAPE indicates that the model is more accurate.
Example
Let’s say we have a machine learning model that predicts the daily sales of a store. We want to evaluate the accuracy of the model using MAPE.
We have the following data:
Day | Actual Sales | Predicted Sales
-----+--------------+----------------
1 | 100 | 105
2 | 200 | 190
3 | 150 | 140
4 | 300 | 315
5 | 250 | 260
Using the formula for MAPE, we can calculate the error for each day:
Day | Actual Sales | Predicted Sales | Error
-----+--------------+----------------+-------
1 | 100 | 105 | 5%
2 | 200 | 190 | 5%
3 | 150 | 140 | 6.7%
4 | 300 | 315 | 5%
5 | 250 | 260 | 4%
The average error is the sum of the errors divided by the total number of observations:
MAPE = (1/5) * (5% + 5% + 6.7% + 5% + 4%) = 5.34%
Therefore, the MAPE of the model is 5.34%, which indicates that it is relatively accurate.
Interpretation
MAPE is a useful metric for evaluating the accuracy of machine learning models, but it has some limitations. One of the main limitations is that it is highly sensitive to outliers. If the actual or predicted values are extremely high or low, it can skew the MAPE and make it difficult to interpret.
Another limitation is that MAPE cannot handle zero or negative values. If the target variable includes zero or negative values, a modified version of MAPE, called Symmetric MAPE (SMAPE), should be used instead.
Despite these limitations, MAPE is a widely used metric in the field of machine learning, and it can provide valuable insights into the performance of models that make predictions on continuous data.