8000 FIX LabelEncoder to correctly handle string labels · scikit-learn/scikit-learn@7a54392 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a54392

Browse files
committed
FIX LabelEncoder to correctly handle string labels
1 parent 2900c5a commit 7a54392

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sklearn/linear_model/logistic.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
"""
32
Logistic Regression
43
"""
@@ -1525,8 +1524,7 @@ def fit(self, X, y, sample_weight=None):
15251524
cv = check_cv(self.cv, y, classifier=True)
15261525
folds = list(cv.split(X, y))
15271526

1528-
self._enc = LabelEncoder()
1529-
self._enc.fit(y)
1527+
y = LabelEncoder().fit_transform(y)
15301528

15311529
labels = self.classes_ = np.unique(y)
15321530
n_classes = len(labels)

0 commit comments

Comments
 (0)
0