Calculate the Mean Absolute Percentage Error (MAPE) between predicted and observed values. Input your values and visualize the differences between them.

**Mean Absolute Percentage Error (MAPE):**

## Understanding Mean Absolute Percentage Error (MAPE)

The **Mean Absolute Percentage Error (MAPE)** is a widely used metric to measure the accuracy of a model in predicting values. It calculates the percentage difference between the predicted and observed values and averages these percentages. The smaller the MAPE, the better the model is at predicting the values.

### Formula for MAPE

### Example of MAPE Calculation

Let’s consider an example with the following observed and predicted values:

- Observed values: [10, 13, 14]
- Predicted values: [13, 13, 11]

The steps to calculate MAPE are:

- Find the absolute percentage differences for each pair of observed and predicted values:
- \( \left| \frac{10 - 13}{10} \right| \times 100 = 30\% \)
- \( \left| \frac{13 - 13}{13} \right| \times 100 = 0\% \)
- \( \left| \frac{14 - 11}{14} \right| \times 100 = 21.43\% \)
- Next, average these percentages: \( \frac{30 + 0 + 21.43}{3} \approx 17.14\% \).

Thus, the MAPE for this example is approximately 17.14%.

### When to Use MAPE?

MAPE is commonly used in forecasting applications and regression tasks where the accuracy of model predictions needs to be assessed in percentage terms. It is an intuitive metric because it expresses the error as a percentage, making it easier to understand and compare between models.

### Further Reading

Suf is a senior advisor in data science with deep expertise in Natural Language Processing, Complex Networks, and Anomaly Detection. Formerly a postdoctoral research fellow, he applied advanced physics techniques to tackle real-world, data-heavy industry challenges. Before that, he was a particle physicist at the ATLAS Experiment of the Large Hadron Collider. Now, he’s focused on bringing more fun and curiosity to the world of science and research online.