functional_metrics

Functions

mape(y_true, y_pred[, eps])

Mean absolute percentage error.

max_deviation(y_true, y_pred)

Max Deviation metric.

sign(y_true, y_pred)

Sign error metric.

smape(y_true, y_pred[, eps])

Symmetric mean absolute percentage error.

wape(y_true, y_pred)

Weighted average percentage Error metric.

mape(y_true: List[Union[float, List[float]]], y_pred: List[Union[float, List[float]]], eps: float = 1e-15) float[source]

Mean absolute percentage error.

Wikipedia entry on the Mean absolute percentage error

Parameters
  • y_true (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Ground truth (correct) target values.

  • y_pred (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Estimated target values.

  • eps (float=1e-15) – MAPE is undefined for y_true[i]==0 for any i, so all zeros y_true[i] are clipped to max(eps, abs(y_true)).

Returns

A non-negative floating point value (the best value is 0.0).

Return type

float

max_deviation(y_true: List[Union[float, List[float]]], y_pred: List[Union[float, List[float]]]) float[source]

Max Deviation metric.

Parameters
  • y_true (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Ground truth (correct) target values.

  • y_pred (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Estimated target values.

Returns

A floating point value (the best value is 0.0).

Return type

float

sign(y_true: List[Union[float, List[float]]], y_pred: List[Union[float, List[float]]]) float[source]

Sign error metric.

\[Sign(y\_true, y\_pred) = \frac{1}{n}\cdot\sum_{i=0}^{n - 1}{sign(y\_true_i - y\_pred_i)}\]
Parameters
  • y_true (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Ground truth (correct) target values.

  • y_pred (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Estimated target values.

Returns

A floating point value (the best value is 0.0).

Return type

float

smape(y_true: List[Union[float, List[float]]], y_pred: List[Union[float, List[float]]], eps: float = 1e-15) 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 (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Ground truth (correct) target values.

  • y_pred (List[Union[float, List[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 any i, so all zeros y_true[i] + y_pred[i] are clipped to max(eps, abs(y_true) + abs(y_pred)).

Returns

A non-negative floating point value (the best value is 0.0).

Return type

float

wape(y_true: List[Union[float, List[float]]], y_pred: List[Union[float, List[float]]]) float[source]

Weighted average percentage Error metric.

\[WAPE(y\_true, y\_pred) = \frac{\sum_{i=0}^{n} |y\_true_i - y\_pred_i|}{\sum_{i=0}^{n}|y\_true_i|}\]
Parameters
  • y_true (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Ground truth (correct) target values.

  • y_pred (List[Union[float, List[float]]]) –

    array-like of shape (n_samples,) or (n_samples, n_outputs)

    Estimated target values.

Returns

A floating point value (the best value is 0.0).

Return type

float