Skip to content

Commit 03dbec8

Browse files
committed
fixed reverse sorting issue in label_binarize()
1 parent 6c81fbc commit 03dbec8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/preprocessing/label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def label_binarize(y, classes, neg_label=0, pos_label=1,
559559

560560
# preserve label ordering
561561
if np.any(classes != sorted_class):
562-
indices = np.argsort(classes)
562+
indices = np.searchsorted(sorted_class, classes)
563563
Y = Y[:, indices]
564564

565565
if y_type == "binary":

0 commit comments

Comments
 (0)