Calculate mean absolute percentage error for regression forecast accuracy.
Mean Absolute Percentage Error (MAPE) expresses prediction error as a percentage of the actual value: MAPE = (100/n) × Σ|(y_i − ŷ_i)/y_i|. Because it's scale-independent, MAPE is popular for comparing forecast accuracy across series with very different magnitudes (e.g. comparing demand forecasts for a $10 product and a $10,000 product on the same scale). Its major limitation is that it's undefined when actual values are zero and becomes extremely large (and asymmetric) for actual values near zero, so it should be avoided when the target can be zero or close to it.
MAPE = (100 / n) * sum(|(y_i - y_hat_i) / y_i|)
MAPE divides by the actual value for each term, so a zero actual value causes division by zero; this calculator skips those data points and computes MAPE only over the remaining valid samples.
MAPE penalizes over-predictions and under-predictions differently in percentage terms — since the percentage error is capped at 100% for under-predictions (predicting 0 when actual is 100) but unbounded for over-predictions (predicting 1000 when actual is 100), it can bias model selection toward under-forecasting.
sMAPE (symmetric MAPE) is preferred when you want a percentage-based error metric that treats over- and under-predictions symmetrically, and it's better behaved when actual values are close to zero.