## What is MAPE?

MAPE (Mean Absolute Percentage Error) is an error metric used to measure the performance of regression machine learning models. It is a popular metric to use amongst data scientists as it returns the error as a percentage, making it both easy for end users to understand and simpler to compare model accuracy across use cases and datasets.

## What is a good MAPE score?

MAPE returns error as a percentage, making it refreshingly easy to understand the 'goodness' of the error value. The lower the percentage, the more accurate the model, so 10% is better than 60%. It goes without saying that how 'good' your MAPE score is depends very much so on your use case and dataset, but a general rule of thumb that I follow is:

MAPE Interpretation
< 10 % Very good
10 % - 20 % Good
20 % - 50 % OK
> 50 % Not good

## How is MAPE calculated?

Calculating MAPE in Python is simple to do using the scikit-learn package:

``````from sklearn.metrics import mean_absolute_percentage_error

actual = [10,12,8]
prediction = [9,14.5,8.2]
mape = mean_absolute_percentage_error(actual, prediction)``````

The mathematical formula for MAPE is as follows:

Which states that for every row the difference between the prediction and the actual is calculated and then divided by the actual. We then calculate the mean value of all these absolute values, giving us our MAPE value.

## Is MAPE similar to MAE?

MAPE takes MAE (mean absolute error) one step further, by adding in the actual value division to convert it to a percentage. This is not to say that MAPE is better than MAE, as they offer different views on the error of your model and are both good metrics to track in your model development.

## Positives and negatives of using MAPE

MAPE is a popular metric to use for regression machine learning models, however there are some things one must consider when optimising for this metric:

### Positives

1. Error given as a percentage
2. Easy for end users to understand
3. Possible to compare model accuracy across datasets and use cases

### Negatives

1. If your actual values can be 0, then MAPE isn't a good error metric, as you will have division by 0
2. Sensitive to outliers

### Metric comparisons

RMSE vs MAPE, which is the best regression metric?

### Metric calculators

MAPE calculator

scikit-learn documentation