8000 Modify sklearn/decomposition/sparse_pca.py · scikit-learn/scikit-learn@aecae5f · GitHub
[go: up one dir, main page]

Skip to content

Commit aecae5f

Browse files
Maria AndriopoulouMaria Andriopoulou
Maria Andriopoulou
authored and
Maria Andriopoulou
committed
Modify sklearn/decomposition/sparse_pca.py
1 parent 54bb37c commit aecae5f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/decomposition/sparse_pca.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88

99
from ..utils import check_random_state, check_array
10-
from ..utils.validation import check_is_fitted
10+
from ..utils.validation import check_is_fitted, FLOAT_DTYPES
1111
from ..linear_model import ridge_regression
1212
from ..base import BaseEstimator, TransformerMixin
1313
from .dict_learning import dict_learning, dict_learning_online
@@ -115,7 +115,7 @@ def fit(self, X, y=None):
115115
Returns the instance itself.
116116
"""
117117
random_state = check_random_state(self.random_state)
118-
X = check_array(X)
118+
X = check_array(X, dtype=FLOAT_DTYPES)
119119
if self.n_components is None:
120120
n_components = X.shape[1]
121121
else:
@@ -168,7 +168,7 @@ def transform(self, X, ridge_alpha='deprecated'):
168168
"""
169169
check_is_fitted(self, 'components_')
170170

171-
X = check_array(X)
171+
X = check_array(X, dtype=FLOAT_DTYPES)
172172
if ridge_alpha != 'deprecated':
173173
warnings.warn("The ridge_alpha parameter on transform() is "
174174
"deprecated since 0.19 and will be removed in 0.21. "
@@ -285,7 +285,7 @@ def fit(self, X, y=None):
285285
Returns the instance itself.
286286
"""
287287
random_state = check_random_state(self.random_state)
288-
X = check_array(X)
288+
X = check_array(X, dtype=FLOAT_DTYPES)
289289
if self.n_components is None:
290290
n_components = X.shape[1]
291291
else:

0 commit comments

Comments
 (0)
0