8000 FIX remove action of normalize_components in SparsePCA (#14134) · rth/scikit-learn@e94f5de · GitHub
[go: up one dir, main page]

Skip to content

Commit e94f5de

Browse files
glemaitrethomasjpfan
authored andcommitted
FIX remove action of normalize_components in SparsePCA (scikit-learn#14134)
1 parent 3d99769 commit e94f5de

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

doc/whats_new/v0.22.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ parameters, may produce different models from the previous version. This often
1717
occurs due to changes in the modelling logic (bug fixes or enhancements), or in
1818
random sampling procedures.
1919

20-
..
21-
TO FILL IN AS WE GO
20+
- :class:`decomposition.SparsePCA` where `normalize_components` has no effect
21+
due to deprecation.
2222

2323
Details are listed in the changelog below.
2424

sklearn/decomposition/sparse_pca.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,11 @@ def transform(self, X):
224224
check_is_fitted(self, 'components_')
225225

226226
X = check_array(X)
227-
228-
if self.normalize_components:
229-
X = X - self.mean_
227+
X = X - self.mean_
230228

231229
U = ridge_regression(self.components_.T, X.T, self.ridge_alpha,
232230
solver='cholesky')
233231

234-
if not self.normalize_components:
235-
s = np.sqrt((U ** 2).sum(axis=0))
236-
s[s == 0] = 1
237-
U /= s
238-
239232
return U
240233

241234

0 commit comments

Comments
 (0)
0