Computes the mean absolute percentage error (MAPE) between predicted and reference values.
Usage
mape(x, ...)
# S3 method for class 'lm'
mape(x, ...)
# Default S3 method
mape(x, ref, na.rm = FALSE, ...)Value
a numeric scalar containing the MAPE, as a fraction,
not a percentage: a mean absolute relative error of six percent is
returned as 0.06. Multiply by 100 for the percentage form. The
name is conventional; the definition below is the one implemented.
Details
The MAPE is defined as: $$ \frac{1}{n} \sum \left| \frac{ref - x}{ref} \right| $$
Note that values where ref = 0 lead to division by zero and
result in NA.
See also
Other model.metrics:
auc(),
averagePrecision(),
brierScore(),
logLoss(),
mae(),
mse(),
nmae(),
nmse(),
rmse(),
smape()
