8000 ENH avoid slow CSR fancy indexing variant · scikit-learn/scikit-learn@8f0d4fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f0d4fc

Browse files
committed
ENH avoid slow CSR fancy indexing variant
See scipy/scipy#5265
1 parent 9cfb506 commit 8f0d4fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/bicluster/bicluster_newsgroups.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ def bicluster_ncut(i):
132132
return sys.float_info.max
133133
row_complement = np.nonzero(np.logical_not(cocluster.rows_[i]))[0]
134134
col_complement = np.nonzero(np.logical_not(cocluster.columns_[i]))[0]
135-
weight = X[rows[:, np.newaxis], cols].sum()
136-
cut = (X[row_complement[:, np.newaxis], cols].sum() +
137-
X[rows[:, np.newaxis], col_complement].sum())
135+
weight = X[rows][:, cols].sum()
136+
cut = (X[row_complement][:, cols].sum() +
137+
X[rows][:, col_complement].sum())
138138
return cut / weight
139139

140140

0 commit comments

Comments
 (0)
0