8000 CLN: remove duplicate validation of X in Encoders transform (#13347) · scikit-learn/scikit-learn@afd4321 · GitHub
[go: up one dir, main page]

Skip to content

Commit afd4321

Browse files
CLN: remove duplicate validation of X in Encoders transform (#13347)
1 parent 37b0e66 commit afd4321

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

sklearn/preprocessing/_encoders.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -675,16 +675,11 @@ def _legacy_transform(self, X):
675675

676676
def _transform_new(self, X):
677677
"""New implementation assuming categorical input"""
678-
X_temp = check_array(X, dtype=None)
679-
if not hasattr(X, 'dtype') and np.issubdtype(X_temp.dtype, np.str_):
680-
X = check_array(X, dtype=np.object)
681-
else:
682-
X = X_temp
683-
684-
n_samples, n_features = X.shape
685-
678+
# validation of X happens in _check_X called by _transform
686679
X_int, X_mask = self._transform(X, handle_unknown=self.handle_unknown)
687680

681+
n_samples, n_features = X_int.shape
682+
688683
if self.drop is not None:
689684
to_drop = self.drop_idx_.reshape(1, -1)
690685

0 commit comments

Comments
 (0)
0