pmdarima.metrics.smape

pmdarima.metrics.smape(y_true, y_pred)[source][source]

Compute the Symmetric Mean Absolute Percentage Error.

The symmetric mean absolute percentage error (SMAPE) is an accuracy measure based on percentage (or relative) errors. Defined as follows:

\(\frac{100\%}{n}\sum_{t=1}^{n}{\frac{|F_{t}-A_{t}|}{ (|A_{t}|+|F_{t}|)/2}}\)

Where a perfect SMAPE score is 0.0, and a higher score indicates a higher error rate.

Parameters:

y_true : array-like, shape=(n_samples,)

The true test values of y.

y_pred : array-like, shape=(n_samples,)

The forecasted values of y.

References

[R88]https://en.wikipedia.org/wiki/Symmetric_mean_absolute_percentage_error

Examples

A typical case: >>> import numpy as np >>> y_true = np.array([0.07533, 0.07533, 0.07533, 0.07533, … 0.07533, 0.07533, 0.0672, 0.0672]) >>> y_pred = np.array([0.102, 0.107, 0.047, 0.1, … 0.032, 0.047, 0.108, 0.089]) >>> smape(y_true, y_pred) 42.60306631890196

A perfect score: >>> smape(y_true, y_true) 0.0