We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8066ff6 commit 2b69aa9Copy full SHA for 2b69aa9
sklearn/preprocessing/label.py
@@ -547,7 +547,8 @@ def transform(self, y):
547
A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
548
`y[i]`, and 0 otherwise.
549
"""
550
- yt = self._transform(y, {k: i for i, k in enumerate(self.classes_)})
+ class_to_index = dict(zip(self.classes_, range(len(self.classes_))))
551
+ yt = self._transform(y, class_to_index)
552
return yt.toarray()
553
554
def _transform(self, y, class_mapping):
0 commit comments