mapie.metrics.classification.classification_mean_width_score

mapie.metrics.classification.classification_mean_width_score(y_pred_set: ArrayLike) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Mean width of prediction set output by mapie.classification._MapieClassifier.

Parameters:
y_pred_set: NDArray of shape (n_samples, n_class, n_confidence_level)

Prediction sets given by booleans of labels.

Returns:
NDArray of shape (n_confidence_level,)

Mean width of the prediction sets for each confidence level.

Examples

>>> import numpy as np
>>> from mapie.metrics.classification import classification_mean_width_score
>>> y_pred_set = np.array([
...     [[False, False], [False, True], [True, True]],
...     [[False, True], [True, False], [True, True]],
...     [[True, False], [True, True], [True, False]],
...     [[False, False], [True, True], [True, True]],
...     [[True, True], [False, True], [True, False]]
... ])
>>> print(classification_mean_width_score(y_pred_set))
[2.  1.8]

Examples using mapie.metrics.classification.classification_mean_width_score

LAC and APS methods explained

LAC and APS methods explained

Set prediction example in the binary classification setting

Set prediction example in the binary classification setting

Cross conformal classification explained

Cross conformal classification explained