@@ -787,7 +787,7 @@ def roc_curve(y_true, y_score, pos_label=None, sample_weight=None,
787
787
def cumulative_gain_curve (y_true , y_score , pos_label = None ):
788
788
"""Compute Cumulative Gain for each ten percent of the sample
789
789
Note: This implementation is restricted to the binary classification task.
790
-
790
+
791
791
Parameters
792
792
----------
793
793
@@ -811,10 +811,10 @@ def cumulative_gain_curve(y_true, y_score, pos_label=None):
811
811
Examples
812
812
--------
813
813
>>> import numpy as np
814
- >>> from sklearn import metrics
814
+ >>> from sklearn.metrics import cumulative_gain_curve
815
815
>>> y_true = [0, 1, 1, 0, 0, 0, 1, 1, 0, 0]
816
816
>>> y_pred = [0.1, 0.8, 0.9, 0,3, 0.4, 0.6, 0.6, 0.6, 0.44]
817
- >>> percentages, gains = metrics. cumulative_gain_curve(y_true, y_pred, pos_label=1)
817
+ >>> percentages, gains = cumulative_gain_curve(y_true, y_pred, pos_label=1)
818
818
>>> percentages
819
819
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ])
820
820
>>> gains
@@ -1061,8 +1061,9 @@ def label_ranking_loss(y_true, y_score, sample_weight=None):
1061
1061
true_at_reversed_rank = np .bincount (
1062
1062
unique_inverse [y_true .indices [start :stop ]],
1063
1063
minlength = len (unique_scores ))
1064
- all_at_reversed_rank = np .bincount (unique_inverse ,
1065
- minlength = len (unique_scores ))
1064
+ all_at_reversed_rank = np .bincount (
1065
+ unique_inverse ,
1066
+ minlength = len (unique_scores ))
1066
1067
false_at_reversed_rank = all_at_reversed_rank - true_at_reversed_rank
1067
1068
1068
1069
# if the scores are ordered, it's possible to count the number of
0 commit comments