10000 as_float_array removed · scikit-learn/scikit-learn@7fe71c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fe71c1

Browse files
committed
as_float_array removed
1 parent 3c988d5 commit 7fe71c1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

sklearn/preprocessing/imputation.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
from ..base import BaseEstimator, TransformerMixin
1212
from ..utils import check_array
13-
from ..utils import as_float_array
1413
from ..utils.fixes import astype
1514
from ..utils.sparsefuncs import _get_median
1615
from ..utils.validation import check_is_fitted
16+
from ..utils.validation import FLOAT_DTYPES
1717

1818
from ..externals import six
1919

@@ -310,15 +310,12 @@ def transform(self, X):
310310
if self.axis == 0:
311311
check_is_fitted(self, 'statistics_')
312312

313-
# Copy just once
314-
X = as_float_array(X, copy=self.copy, force_all_finite=False)
315-
316313
# Since two different arrays can be provided in fit(X) and
317314
# transform(X), the imputation data need to be recomputed
318315
# when the imputation is done per sample
319316
if self.axis == 1:
320-
X = check_array(X, accept_sparse='csr', force_all_finite=False,
321-
copy=False)
317+
X = check_array(X, accept_sparse='csr', dtype=FLOAT_DTYPES,
318+
force_all_finite=False, copy=self.copy)
322319

323320
if sparse.issparse(X):
324321
statistics = self._sparse_fit(X,
@@ -332,8 +329,8 @@ def transform(self, X):
332329
self.missing_values,
333330
self.axis)
334331
else:
335-
X = check_array(X, accept_sparse='csc', force_all_finite=False,
336-
copy=False)
332+
X = check_array(X, accept_sparse='csc', dtype=FLOAT_DTYPES,
333+
force_all_finite=False, copy=self.copy)
337334
statistics = self.statistics_
338335

339336
# Delete the invalid rows/columns

0 commit comments

Comments
 (0)
0