Fork me on GitHub

sklearn.metrics.label_ranking_loss

sklearn.metrics.label_ranking_loss(y_true, y_score, sample_weight=None)[source]

Compute Ranking loss measure

Compute the average number of label pairs that are incorrectly ordered given y_score weighted by the size of the label set and the number of labels not in the label set.

This is similar to the error set size, but weighted by the number of relevant and irrelevant labels. The best performance is achieved with a ranking loss of zero.

Read more in the User Guide.

New in version 0.17: A function label_ranking_loss

Parameters:

y_true : array or sparse matrix, shape = [n_samples, n_labels]

True binary labels in binary indicator format.

y_score : array, shape = [n_samples, n_labels]

Target scores, can either be probability estimates of the positive class, confidence values, or binary decisions.

sample_weight : array-like of shape = [n_samples], optional

Sample weights.

Returns:

loss : float

References

[R180]Tsoumakas, G., Katakis, I., & Vlahavas, I. (2010). Mining multi-label data. In Data mining and knowledge discovery handbook (pp. 667-685). Springer US.
Previous