@@ -38,13 +38,13 @@ def _scale_normalize(X):
38
38
row_diag = np .asarray (1.0 / np .sqrt (X .sum (axis = 1 )))
39
39
if row_diag .shape [0 ] != 1 :
40
40
row_diag = row_diag .squeeze ()
41
-
41
+
42
42
col_diag = np .asarray (1.0 / np .sqrt (X .sum (axis = 0 )))
43
- if col_diag .ndim == 1 and col_diag .shape [0 ]!= 1 :
43
+ if col_diag .ndim == 1 and col_diag .shape [0 ] != 1 :
44
44
col_diag = col_diag .squeeze ()
45
- if col_diag .ndim == 2 and col_diag .shape [0 ] == 1 and col_diag . shape [ 1 ] != 1 :
45
+ if col_diag .ndim == 2 and col_diag .shape [1 ] != 1 :
46
46
col_diag = col_diag .squeeze ()
47
-
47
+
48
48
row_diag = np .where (np .isnan (row_diag ), 0 , row_diag )
49
49
col_diag = np .where (np .isnan (col_diag ), 0 , col_diag )
50
50
@@ -296,7 +296,7 @@ def _fit(self, X):
296
296
297
297
z = np .vstack ((row_diag [:, np .newaxis ] * u ,
298
298
col_diag [:, np .newaxis ] * v ))
299
-
299
+
300
300
_ , labels = self ._k_means (z , self .n_clusters )
301
301
302
302
n_rows = X .shape [0 ]
@@ -493,7 +493,7 @@ def _fit(self, X):
493
493
for _ in range (n_row_clusters )
494
494
for label in range (n_col_clusters ))
495
495
return self
496
-
496
+
497
497
def _fit_best_piecewise (self , vectors , n_best , n_clusters ):
498
498
"""Find the ``n_best`` vectors that are best approximated by piecewise
499
499
constant vectors.
0 commit comments