Skip to content

Commit 2bfca14

Browse files
hamsaljnothman
authored andcommitted
ENH sparse matrix support in label binarization
1 parent 708d3a3 commit 2bfca14

File tree

6 files changed

+608
-226
lines changed

6 files changed

+608
-226
lines changed

doc/modules/preprocessing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ matrix from a list of multi-class labels::
370370

371371
>>> lb = preprocessing.LabelBinarizer()
372372
>>> lb.fit([1, 2, 6, 4, 2])
373-
LabelBinarizer(neg_label=0, pos_label=1)
373+
LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)
374374
>>> lb.classes_
375375
array([1, 2, 4, 6])
376376
>>> lb.transform([1, 6])

sklearn/linear_model/ridge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def fit(self, X, y):
571571
"""
572572
self._label_binarizer = LabelBinarizer(pos_label=1, neg_label=-1)
573573
Y = self._label_binarizer.fit_transform(y)
574-
if not self._label_binarizer.multilabel_:
574+
if not self._label_binarizer.y_type_.startswith('multilabel'):
575575
y = column_or_1d(y, warn=True)
576576

577577
if self.class_weight:

0 commit comments

Comments
 (0)