Repository navigation
MNT Move entropy to private function - #31294
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.
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.
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.
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.
Okay to deprecate it the usual way. Just a couple of comments
jeremiedbb
left a comment
There was a problem hiding this comment.
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.
I just miss a changelog entry since it affect public API.
|
@glemaitre good point. Done. |
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