opkwatcher.blogg.se

How to calculate percent error
How to calculate percent error











how to calculate percent error

Return np.mean(np.abs((actual - pred) / actual)) * 100 There is no built-in Python function to calculate MAPE, but we can create a simple function to do so: import numpy as npĪctual, pred = np.array(actual), np.array(pred)

how to calculate percent error

For example, a model with a MAPE of 5% is more accurate than a model with a MAPE of 10%.

how to calculate percent error

The lower the value for MAPE, the better a model is able to predict values. For example, a MAPE value of 11.5% means that the average difference between the predicted value and the actual value is 11.5%. MAPE is commonly used because it’s easy to interpret and easy to explain. The mean absolute percentage error (MAPE) is commonly used to measure the predictive accuracy of models.













How to calculate percent error