Computes the symmetric mean absolute percentage error (SMAPE) between predicted and reference values.
Usage
smape(x, ...)
# S3 method for class 'lm'
smape(x, ...)
# Default S3 method
smape(x, ref, na.rm = FALSE, ...)Details
The SMAPE is defined as: $$ \frac{1}{n} \sum \frac{2 |ref - x|}{|x| + |ref|} $$
Values are bounded between 0 and 2. Note that this is a ratio, not a percentage: the factor 100 of the original definition is not applied, which is the form for which the bound of 2 holds.
A term is undefined when x and ref are both zero, and is set
to NA. With the default na.rm = FALSE a single such pair
therefore makes the whole result NA; with na.rm = TRUE those
terms are dropped along with genuinely missing ones, so the mean is taken
over fewer than length(x) terms.
See also
Other model.metrics:
auc(),
averagePrecision(),
brierScore(),
logLoss(),
mae(),
mape(),
mse(),
nmae(),
nmse(),
rmse()
