Skip to content
EvalSuite
Documentation menu

Regression

Available in v0.1.0

Usage

Pythonv0.1.0
import evalsuite as es

es.mae(y_true, y_pred)
es.rmse(y_true, y_pred, sample_weight=w)
es.mape(y_true, y_pred)   # raises MetricInputError if any target is zero

es.evaluate(y_true, y_pred)   # MAE, MSE, RMSE, R² and more in one call

Single and multi-output targets are supported (multioutput="uniform_average", "raw_values" or weights).

Domain restrictions

Some metrics are only defined on part of the real line. Inputs are checked before computation:

  • MAPE requires every target to be non-zero.
  • MSLE and RMSLE require targets and predictions greater than −1.
  • R² is undefined for constant targets.

Invalid inputs raise MetricInputError instead of producing infinities or misleading values.

Metrics

  • Average absolute difference between predictions and targets, in target units.

    es.mae

  • Average squared difference between predictions and targets.

    es.mse

  • Square root of MSE, expressed in target units.

    es.rmse

  • Proportion of variance in the target explained by the predictions, relative to predicting the mean.

    es.r2

  • Adjusted R²Implemented

    R² penalised for the number of predictors in the model.

    es.adjusted_r2

  • Average absolute error relative to the magnitude of the target.

    es.mape

  • Symmetric MAPEImplemented

    Percentage error scaled by the mean magnitude of target and prediction.

    es.smape

  • RMSE computed on log(1 + value), emphasising relative rather than absolute error.

    es.rmsle

  • Median of absolute errors; robust to outliers.

    es.median_absolute_error

  • Huber lossImplemented

    Quadratic for small errors and linear for large errors, controlled by δ.

    es.huber_loss

  • Asymmetric loss used to evaluate quantile predictions.

    es.quantile_loss