-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX ‘sparse’ kwarg was not used by fowlkes_mallows_score #28981
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
Conversation
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.
would it be possible to add a test for this please.
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.
Thanks @cynddl . Could you please add a test as well?
@@ -1181,7 +1181,7 @@ def normalized_mutual_info_score( | |||
}, | |||
prefer_skip_nested_validation=True, | |||
) | |||
def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False): | |||
def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=True): |
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 wouldn't change the default here though.
Setting Instead of "making this keyword argument work" I think it makes sense to "remove his keyword argument". It is not used, has not been used and provides no advantages. |
That's true, the code actually relies on the output (c) being sparse. So we can deprecate the parameter here. |
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 made the requested changes to deprecate the param instead.
LGTM.
Reference Issues/PRs
No issue.
What does this implement/fix? Explain your changes.
The function sklearn.metrics.fowlkes_mallows_score was defined with:
but the code never uses sparse. The parameter sparse should have been passed to contingency_matrix, but instead we currently see a few lines later:
This commit fixes the inconsistency by:
Any other comments?
The function sklearn.metrics.fowlkes_mallows_score has never been tested with sparse=False, it might be good to have a few tests for that use case too?