8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 770d089 + a24b932 commit b9284a7Copy full SHA for b9284a7
examples/bicluster/bicluster_newsgroups.py
@@ -132,9 +132,11 @@ def bicluster_ncut(i):
132
return sys.float_info.max
133
row_complement = np.nonzero(np.logical_not(cocluster.rows_[i]))[0]
134
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())
+ # Note: the following is identical to X[rows[:, np.newaxis], cols].sum() but
+ # much faster in scipy <= 0.16
+ weight = X[rows][:, cols].sum()
138
+ cut = (X[row_complement][:, cols].sum() +
139
+ X[rows][:, col_complement].sum())
140
return cut / weight
141
142
0 commit comments