Skip to content

DOC: AgglomerativeCluster Metric Keyword Documentation #29935

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

Merged

Conversation

Sean-Jay-M
Copy link
Contributor

@Sean-Jay-M Sean-Jay-M commented Sep 26, 2024

Reference Issues/PRs

#26961

This issue is on the maintenance board under moderate.

In the discussion it has been noted that the issue can be broken into three parts. This PR covers the following part:
it deprecates the keyword affinity and updates the documentation for the metrics keyword. Updates the documentation for the 'metric' keyword argument.

First, the documentation for affinity is outdated and incorrect (note that the keyword is also deprecated), whereas the documentation for metric more accurate but still not complete. What's missing is that when connectivity=None and linkage="single" (and affinity!="precomputed"), any valid pairwise distance metric (i.e. metric in sklearn.metrics.pairwise._VALID_METRICS) works.

What does this implement/fix? Explain your changes.

Deprecates affinity keyword, updates documentation and updates tests.
Updates the documentation for the 'metric' keyword argument.

Additional Comments:

Will add to changelog in coming days.

Changelog Added.

Further improves documentation for the Metric keyword.
Copy link

github-actions bot commented Sep 26, 2024

✔️ Linting Passed

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

Generated for commit: 297ceeb. Link to the linter CI: here

@Sean-Jay-M Sean-Jay-M changed the title AgglomerativeCluster Affinity Keyword Deprecation and Implementation of Metric MAINT: AgglomerativeCluster Affinity Keyword Deprecation and Implementation of Metric Sep 27, 2024
@Sean-Jay-M
Copy link
Contributor Author

Sean-Jay-M commented Oct 3, 2024

@jeremiedbb or @glemaitre , requesting either give this a quick look and let me know if this pr is beneficial to the project. Goal is to deprecate affinity keyword as per the linked conversation.

Edit: Conflicts Resolved.

@glemaitre
Copy link
Member

I went through the original issue. There is no need to change any code. The only thing that @Micky774 is mentioning is to document the fact that metric can take any valid metric when linkage="single" and connectivity=None.

So there is no need to change any code in the private functions.

@Sean-Jay-M
Copy link
Contributor Author

Sean-Jay-M commented Oct 11, 2024

I went through the original issue. There is no need to change any code. The only thing that @Micky774 is mentioning is to document the fact that metric can take any valid metric when linkage="single" and connectivity=None.

So there is no need to change any code in the private functions.

Ok I misunderstood the assignment so, I thought the keyword affinity had to be removed. Thanks, I'll change this PR into a DOC pr and alter the docs only and undo the other changes.

@glemaitre
Copy link
Member

I thought the keyword affinity had to be removed

Indeed, it already had been removed in a prior version of scikit-learn. Since the issue is old, at this time, the parameter was only deprecate and announced to be removed. So I agree that it is pretty confusing :)

@Sean-Jay-M Sean-Jay-M marked this pull request as draft October 17, 2024 15:56
@Sean-Jay-M Sean-Jay-M changed the title MAINT: AgglomerativeCluster Affinity Keyword Deprecation and Implementation of Metric DOC: AgglomerativeCluster Metric Keyword Documentation Oct 25, 2024
@Sean-Jay-M Sean-Jay-M marked this pull request as ready for review October 25, 2024 18:11
@Sean-Jay-M
Copy link
Contributor Author

@glemaitre Ready for review. Most over the top PR for such a small change to docs !

@glemaitre glemaitre self-requested a review October 28, 2024 17:53
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Sean-Jay-M

@glemaitre glemaitre merged commit 9f518b2 into scikit-learn:main Oct 28, 2024
30 checks passed
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.

2 participants