sklearn.metrics.label_ranking_average_precision_score(y_true, y_score, sample_weight=None)
[source]
Compute rankingbased average precision
Label ranking average precision (LRAP) is the average over each ground truth label assigned to each sample, of the ratio of true vs. total labels with lower score.
This metric is used in multilabel ranking problem, where the goal is to give better rank to the labels associated to each sample.
The obtained score is always strictly greater than 0 and the best value is 1.
Read more in the User Guide.
Parameters: 


Returns: 

>>> import numpy as np >>> from sklearn.metrics import label_ranking_average_precision_score >>> y_true = np.array([[1, 0, 0], [0, 0, 1]]) >>> y_score = np.array([[0.75, 0.5, 1], [1, 0.2, 0.1]]) >>> label_ranking_average_precision_score(y_true, y_score) 0.416...
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.metrics.label_ranking_average_precision_score.html