Skip to content

Commit

Permalink
fix ICA for old sklearn
Browse files Browse the repository at this point in the history
  • Loading branch information
agramfort committed Jan 24, 2018
1 parent a7606d8 commit 9ff30e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mne/preprocessing/ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ def _fit(self, data, max_pca_components, fit_type):
self.pca_mean_ = pca.mean_
self.pca_components_ = pca.components_
self.pca_explained_variance_ = exp_var = pca.explained_variance_
if not check_version('sklearn', '0.16'):
# unwhiten pca components and put scaling in unmixing matrix later.
# sklearn before 0.16 applied the whitening to the components
# but not the new PCA class.
self.pca_components_ *= np.sqrt(exp_var[:, None])
del pca
# update number of components
self.n_components_ = sel.stop
Expand Down

0 comments on commit 9ff30e4

Please sign in to comment.