Skip to content
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

FIX ‘sparse’ kwarg was not used by fowlkes_mallows_score #28981

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cynddl
Copy link

@cynddl cynddl commented May 8, 2024

Reference Issues/PRs

No issue.

What does this implement/fix? Explain your changes.

The function sklearn.metrics.fowlkes_mallows_score was defined with:

def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False):

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:

    contingency_matrix(labels_true, labels_pred, sparse=True)

This commit fixes the inconsistency by:

  • changing the default to sparse=True so that it doesn't break any test or downstream use
  • making sure that contingency_matrix uses the given sparse parameter.

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?

@cynddl cynddl changed the title Sparse kwarg was not used by fowlkes_mallows_score FIX ‘sparse’ kwarg was not used by fowlkes_mallows_score May 8, 2024
Copy link

github-actions bot commented May 8, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 3d2dbd6. Link to the linter CI: here

Copy link

@prabashbala prabashbala left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants