mlens.metrics.metrics module

ML-ENSEMBLE

author:Sebastian Flennerhag
copyright:2017
license:MIT

Scoring functions.

mlens.metrics.metrics.mape(y, p)[source]

Mean Average Percentage Error.

\[MAPE(\mathbf{y}, \mathbf{p}) = |S| \sum_{i \in S} | \frac{y_i - p_i}{y_i} |\]
Parameters:
  • y (array-like of shape [n_samples, ]) – ground truth.
  • p (array-like of shape [n_samples, ]) – predicted labels.
Returns:

z – mean average percentage error.

Return type:

float

mlens.metrics.metrics.rmse(y, p)[source]

Root Mean Square Error.

\[RMSE(\mathbf{y}, \mathbf{p}) = \sqrt{MSE(\mathbf{y}, \mathbf{p})},\]

with

\[MSE(\mathbf{y}, \mathbf{p}) = |S| \sum_{i \in S} (y_i - p_i)^2\]
Parameters:
  • y (array-like of shape [n_samples, ]) – ground truth.
  • p (array-like of shape [n_samples, ]) – predicted labels.
Returns:

z – root mean squared error.

Return type:

float

mlens.metrics.metrics.wape(y, p)[source]

Weighted Mean Average Percentage Error.

\[WAPE(\mathbf{y}, \mathbf{p}) = \frac{\sum_{i \in S} | y_i - p_i|}{ \sum_{i \in S} |y_i|}\]
Parameters:
  • y (array-like of shape [n_samples, ]) – ground truth.
  • p (array-like of shape [n_samples, ]) – predicted labels.
Returns:

z – weighted mean average percentage error.

Return type:

float