smape¶
- smape(y_true: Union[float, Sequence[float], Sequence[Sequence[float]]], y_pred: Union[float, Sequence[float], Sequence[Sequence[float]]], eps: float = 1e-15, multioutput: str = 'joint') Union[float, Sequence[float], Sequence[Sequence[float]]] [source]¶
Symmetric mean absolute percentage error.
Wikipedia entry on the Symmetric mean absolute percentage error
\[SMAPE = \dfrac{100}{n}\sum_{t=1}^{n}\dfrac{|ytrue_{t}-ypred_{t}|}{(|ypred_{t}|+|ytrue_{t}|) / 2}\]- Parameters
y_true (Union[float, Sequence[float], Sequence[Sequence[float]]]) –
array-like of shape (n_samples,) or (n_samples, n_outputs)
Ground truth (correct) target values.
y_pred (Union[float, Sequence[float], Sequence[Sequence[float]]]) –
array-like of shape (n_samples,) or (n_samples, n_outputs)
Estimated target values.
eps (float=1e-15) – SMAPE is undefined for
y_true[i] + y_pred[i] == 0
for anyi
, so all zerosy_true[i] + y_pred[i]
are clipped tomax(eps, abs(y_true) + abs(y_pred))
.multioutput (str) – Defines aggregating of multiple output values (see
FunctionalMetricMultioutput
).
- Returns
A non-negative floating point value (the best value is 0.0), or an array of floating point values, one for each individual target.
- Return type
Union[float, Sequence[float], Sequence[Sequence[float]]]