Repository navigation
Conversation
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Related to #35387.
What does this implement/fix? Explain your changes.
The
calinski_harabasz_scorefunction currently returns1.0whenever the within-cluster dispersion (intra_disp) is zero.However, when clusters are perfectly separated, the within-cluster dispersion is zero while the between-cluster dispersion (
extra_disp) is positive. In this case, the score should be infinite.This PR:
float("inf")whenintra_disp == 0.0andextra_disp > 0.0.1.0when both dispersions are zero.The existing scoring formula remains unchanged for nonzero within-cluster dispersion.
Introduce yourself
Hello! I am a Computer Science and Engineering student specializing in Artificial Intelligence and Data Science.
I am interested in machine learning, data science, and open-source software development. This is my first contribution to scikit-learn.
I found this issue while exploring the clustering metrics implementation. I reproduced the behavior locally, investigated the underlying calculation, implemented a fix, and added a regression test.
I look forward to learning from the scikit-learn community and receiving feedback from the maintainers.
AI usage disclosure
I used AI assistance for:
I independently reproduced the issue, ran the tests, reviewed the changes, and validated the implementation locally.
Any other comments?
Validation performed:
test_unsupervised.py): 50 passed.git diff --check: passed.I would appreciate maintainer feedback on the expected behavior for the zero within-cluster dispersion case, particularly when both dispersions are zero.