coverforest.metrics.average_set_size_loss#
- coverforest.metrics.average_set_size_loss(y_true, y_pred)[source]#
Compute the average size of classification prediction sets.
For each sample, the set size is the number of classes included in the prediction set (sum of binary indicators).
- Parameters:
- Returns:
score – Returns the average prediction set size. Minimum possible value is 0, maximum is n_classes.
- Return type:
Examples
>>> import numpy as np >>> from metrics import average_set_size_loss >>> y_pred = np.array([[1, 0, 0], [1, 1, 0], [0, 0, 1]]) >>> average_set_size_loss(y_pred) 1.333...