-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
MNT Move entropy to private function
#31294
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
|
Indded it's a private function that was never documented. Can you take the opportunity of this PR to remove param validation from this function and making it explicitely private with a leading underscore ? |
entropy to private function
jeremiedbb
left a comment
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'm +1 to rename it with the leading underscore without deprecation since it was not documented.
However, the fact that it was exposed in the plublic sklearn.metrics.cluster namespace and had param validation suggests that it was unclear for us that it really was a private function. So I'd understand if others would rather go with a deprecation. Let's wait for more opinions.
|
LGTM otherwise |
|
I think it does not cost us much to add a public stub that issues a deprecation warning for 2 releases and a TODO comment to remove it afterwards. The deprecation message could make it clear that this undocumented function was never meant to be exposed as public API in the first place. |
| return float(-xp.sum((pi / pi_sum) * (xp.log(pi) - log(pi_sum)))) | ||
|
|
||
|
|
||
| # TODO(1.10): Remove |
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 am assuming this won't make it into 1.7, so deprecate 1.8 / remove 1.10 ?
| "`entropy` is deprecated in 1.8 and will become a private function only from 1.10." | ||
| ) | ||
| def entropy(labels): | ||
| """Public version of `_entropy`. To be deprecated.""" |
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 didn't add a full docstring because I don't think we ever created an API entry for it.
|
Thanks @ogrisel done! |
jeremiedbb
left a comment
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.
Okay to deprecate it the usual way. Just a couple of comments
jeremiedbb
left a comment
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.
LGTM. I just copied the whole docstring into the public function to make the CI happy :)
glemaitre
left a comment
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 just miss a changelog entry since it affect public API.
|
@glemaitre good point. Done. |
glemaitre
left a comment
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.
LGTM. Thanks @lucyleeow
Reference Issues/PRs
Related to #31282
What does this implement/fix? Explain your changes.
entropyis not a API documented function (on purpose) so removing reference to it.Any other comments?
cc @thomasjpfan