10000 Replace chained np.dot with np.linalg.multi_dot · jjerphan/scikit-learn@9d47681 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d47681

Browse files
committed
Replace chained np.dot with np.linalg.multi_dot
np.linalg.multi_dot has shown to be faster for the dot product of 3 matrices. See: scikit-learn#17684 (comment)
1 parent 5212645 commit 9d47681

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/decomposition/_fastica.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def g(x, fun_args):
554554

555555
if self.whiten:
556556
if self.whiten == 'unit-variance':
557-
S = np.dot(np.dot(W, K), X).T
557+
S = np.linalg.multi_dot([W, K, X]).T
558558
S_std = np.std(S, axis=0, keepdims=True)
559559
S /= S_std
560560
W /= S_std.T

0 commit comments

Comments
 (0)
0