mapie.metrics
.classification_mean_width_score¶
- mapie.metrics.classification_mean_width_score(y_pred_set: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]) float [source]¶
Mean width of prediction set output by
MapieClassifier
.- Parameters
- y_pred_set: ArrayLike of shape (n_samples, n_class)
Prediction sets given by booleans of labels.
- Returns
- float
Mean width of the prediction set.
Examples
>>> from mapie.metrics import classification_mean_width_score >>> import numpy as np >>> y_pred_set = np.array([ ... [False, False, True, True], ... [False, True, False, True], ... [False, True, True, False], ... [False, False, True, True], ... [False, True, False, True] ... ]) >>> print(classification_mean_width_score(y_pred_set)) 2.0