![]() |
VOOZH | about |
Mean Absolute Error measures the average difference between predicted values and actual values in a dataset. It shows how far predictions are from the true values without considering direction.
The Mathematical Formula for MAE is:
Where:
Mean Absolute Error (MAE) is calculated by taking the summation of the absolute difference between the actual and calculated values of each observation over the entire array and then dividing the sum obtained by the number of observations in the array.
Example:
Output:
Mean absolute error: 1.8
sklearn.metricsThe sklearn.metrics module in Python provides various tools to evaluate the performance of machine learning models. One of the methods available is mean_absolute_error(), which simplifies the calculation of MAE by handling all the necessary steps internally.
Syntax:
mean_absolute_error(actual,calculated)
Where,
It will return the mean absolute error of the given arrays.
Example:
Output:
Mean absolute error: 1.8
Understanding how MAE compares to other error metrics is crucial for selecting the appropriate evaluation measure.
Metric | Penalizes Large errors | Sensitive to Outliers | Interpretability |
|---|---|---|---|
MAE | No | Less | High |
MSE | Yes | More | Moderate |
RMSE | Yes | More | High |
MAPE | No | Varies | High |