mapie.metrics.regression_mean_width_score

mapie.metrics.regression_mean_width_score(y_pred_low: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], y_pred_up: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) float[source]

Effective mean width score obtained by the prediction intervals.

Parameters
y_pred_low: ArrayLike of shape (n_samples,)

Lower bound of prediction intervals.

y_pred_up: ArrayLike of shape (n_samples,)

Upper bound of prediction intervals.

Returns
float

Effective mean width of the prediction intervals.

Examples

>>> from mapie.metrics import regression_mean_width_score
>>> import numpy as np
>>> y_pred_low = np.array([4, 6, 9, 8.5, 10.5])
>>> y_pred_up = np.array([6, 9, 10, 12.5, 12])
>>> print(regression_mean_width_score(y_pred_low, y_pred_up))
2.3