-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] Use sparse cluster contingency matrix by default #7419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
51aa4a1
0e19274
983747f
925e1a2
952ddaa
a294c05
acb66be
7209a12
0af677b
d91f939
91dceee
0c991fd
31baa1e
5b76cd5
009c5b0
0cbe30d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,8 @@ def expected_mutual_information(contingency, int n_samples): | |
#cdef np.ndarray[int, ndim=2] start, end | ||
R, C = contingency.shape | ||
N = <DOUBLE>n_samples | ||
a = np.sum(contingency, axis=1).astype(np.int32) | ||
b = np.sum(contingency, axis=0).astype(np.int32) | ||
a = np.ravel(contingency.sum(axis=1).astype(np.int32)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it can now be a sparse matrix and the sum over the rows of a sparse matrix is a sparse matrix with a single column instead of a 1D array. |
||
b = np.ravel(contingency.sum(axis=0).astype(np.int32)) | ||
# There are three major terms to the EMI equation, which are multiplied to | ||
# and then summed over varying nij values. | ||
# While nijs[0] will never be used, having it simplifies the indexing. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"uses these by default" is not entirely true, right? Only in the internals, but no return value changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.