forked from scikit-learn/scikit-learn
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH improve numerical stability of orthogonalization in fastica, see s…
- Loading branch information
Showing
1 changed file
with
4 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alimuldal
Author
Owner
|
||
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): | ||
|
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