Skip to content

Commit

Permalink
a bit of cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jona-sassenhagen committed Feb 3, 2020
1 parent e3819b2 commit bc67ef2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sklearn/decomposition/_factor_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ class FactorAnalysis(TransformerMixin, BaseEstimator):
rotation : None | 'varimax' | 'quartimax'
If not None, apply the indicated rotation. Currently, varimax and
quartimax are implemented.
quartimax are implemented. See
`"The varimax criterion for analytic rotation in factor analysis"
<https://link.springer.com/article/10.1007%2FBF02289233>`_
H. F. Kaiser, 1958
random_state : int, RandomState instance, default=0
Only used when ``svd_method`` equals 'randomized'. Pass an int for
Expand Down Expand Up @@ -248,7 +251,7 @@ def my_svd(X):

self.components_ = W
if self.rotation is not None:
self.components_ = self._rotate(W, method=self.rotation)
self.components_ = self._rotate(W)
self.noise_variance_ = psi
self.loglike_ = loglike
self.n_iter_ = i + 1
Expand Down Expand Up @@ -369,10 +372,11 @@ def score(self, X, y=None):
"""
return np.mean(self.score_samples(X))

def _rotate(self, components, method="varimax", n_components=None,
tol=1e-6):
def _rotate(self, components, n_components=None, tol=1e-6):
"Rotate the factor analysis solution."
# note that tol is not exposed
implemented = ("varimax", "quartimax")
method = self.rotation
if method in implemented:
return _ortho_rotation(components.T, method=method,
tol=tol)[:self.n_components]
Expand Down

0 comments on commit bc67ef2

Please sign in to comment.