dask_ml.metrics.mean_absolute_percentage_error

dask_ml.metrics.mean_absolute_percentage_error

dask_ml.metrics.mean_absolute_percentage_error(y_true: dask_ml._typing.ArrayLike, y_pred: dask_ml._typing.ArrayLike, sample_weight: Optional[dask_ml._typing.ArrayLike] = None, multioutput: Optional[str] = 'uniform_average', compute: bool = True) dask_ml._typing.ArrayLike

Mean absolute percentage error regression loss.

Note here that we do not represent the output as a percentage in range [0, 100]. Instead, we represent it in range [0, 1/eps]. Read more in https://scikit-learn.org/stable/modules/model_evaluation.html#mean-absolute-percentage-error

Parameters
y_truearray-like of shape (n_samples,) or (n_samples, n_outputs)

Ground truth (correct) target values.

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

Estimated target values.

sample_weightarray-like of shape (n_samples,), default=None

Sample weights.

multioutput{‘raw_values’, ‘uniform_average’} or array-like

Defines aggregating of multiple output values. Array-like value defines weights used to average errors. If input is list then the shape must be (n_outputs,). ‘raw_values’ :

Returns a full set of errors in case of multioutput input.

‘uniform_average’ :

Errors of all outputs are averaged with uniform weight.

computebool

Whether to compute this result (default True)

Returns
lossfloat or array-like of floats in the range [0, 1/eps]

If multioutput is ‘raw_values’, then mean absolute percentage error is returned for each output separately. If multioutput is ‘uniform_average’ or None, then the equally-weighted average of all output errors is returned. MAPE output is non-negative floating point. The best value is 0.0. But note the fact that bad predictions can lead to arbitarily large MAPE values, especially if some y_true values are very close to zero. Note that we return a large value instead of inf when y_true is zero.