MAE.md (774B)
1 # Mean Absolute Error 2 3 ML CH2 4 5 **Definition:** MAE also known as average absolute deviation or mean absolute error is an error metric used to describe the accuracy of a model by taking the difference between the inference and actual values of a set of samples and averaging the value. 6 7 This is sometimes used when there are many outliers which can largely effect the [RMSE](RMSE.md) error metric because of the way it weights deviations. 8 9 Implementation: 10 11 ```python 12 # Often you would use ordered pairs for expected and inference. 13 expected = [10, 10, 4, 3, 2, 4, 5, 5] 14 inference = [9 , 7, 3, 2, 1, 3, 2, 5] 15 16 count = 0 17 total = 0 18 while count < len(expected): 19 total += abs(expected[count] - inference[count]) 20 count += 1 21 22 total = total / len(expected) 23 print(total) 24 25 ```