File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -503,9 +503,10 @@ def _varimax(self, loadings):
503
503
# and rotation matrix
504
504
basis = np .dot (X , rotation_mtx )
505
505
506
- # transform data for singular value decomposition
507
- transformed = np .dot (X .T , basis ** 3 - (1.0 / n_rows ) *
508
- np .dot (basis , np .diag (np .diag (np .dot (basis .T , basis )))))
506
+ # transform data for singular value decomposition using updated formula :
507
+ # B <- t(x) %*% (z^3 - z %*% diag(drop(rep(1, p) %*% z^2))/p)
508
+ diagonal = np .diag (np .squeeze (np .repeat (1 , n_rows ).dot (basis ** 2 )))
509
+ transformed = X .T .dot (basis ** 3 - basis .dot (diagonal ) / n_rows )
509
510
510
511
# perform SVD on
511
512
# the transformed matrix
@@ -516,7 +517,7 @@ def _varimax(self, loadings):
516
517
d = np .sum (S )
517
518
518
519
# check convergence
519
- if old_d != 0 and d / old_d < 1 + self .tol :
520
+ if d < old_d * ( 1 + self .tol ) :
520
521
break
521
522
522
523
# take inner product of loading matrix
You can’t perform that action at this time.
0 commit comments