Skip to content

Commit

Permalink
ENH improve numerical stability of orthogonalization in fastica, see s…
Browse files Browse the repository at this point in the history
  • Loading branch information
alimuldal committed Jan 10, 2014
1 parent b3a9da9 commit 9c6b89a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sklearn/decomposition/fastica_.py
Expand Up @@ -43,13 +43,12 @@ def _gs_decorrelation(w, W, j):


def _sym_decorrelation(W):
""" Symmetric decorrelation
""" Symmetric decorrelation using SVD
i.e. W <- (W * W.T) ^{-1/2} * W
"""
s, u = linalg.eigh(np.dot(W, W.T))
# u (resp. s) contains the eigenvectors (resp. square roots of
# the eigenvalues) of W * W.T

This comment has been minimized.

Copy link
@rphlypo

rphlypo Feb 19, 2014

This are the eigenvalues of W W.T, not their square roots, although this is not important (commented out). It might be good to remind that they give in principle (theoretically) the same solution since W W.T = U S U.T, and hence (W W.T)^(-1/2) W = U S^(-1/2) U.T U S^(1/2) V.T = U V.T

This comment has been minimized.

Copy link
@alimuldal

alimuldal Feb 19, 2014

Author Owner

Yeah, that comment was in the original fastica code. I'd be happy to make another pull request correcting it.

return np.dot(np.dot(u * (1. / np.sqrt(s)), u.T), W)
U, _, Vt = linalg.svd(W, full_matrices=False)
W = np.dot(U, Vt)
return W


def _ica_def(X, tol, g, fun_args, max_iter, w_init):
Expand Down

0 comments on commit 9c6b89a

Please sign in to comment.