-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX Revert {Ball,KD}Tree.valid_metrics
to public class attributes
#26754
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 Revert {Ball,KD}Tree.valid_metrics
to public class attributes
#26754
Conversation
Also document them. Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
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.
Thanks for the fix. We also need an entry in the changelog for 1.3.1.
Non-regression test for #26742""" | ||
|
||
valid_metrics_list = BinaryTree.valid_metrics | ||
assert all(isinstance(valid_metric, str) for valid_metric in valid_metrics_list) |
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 don't think we need such a test. This attribute is already tested by other code, tests and doctest.
And the fact that it is public API is already stated by the fact that there is no leading underscore in the attribute name, the class name and the module name, and the fact that it is documented in doc/modules/neighbors.rst
.
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
What was the motivation for making it a class method ? Reading the original PR I understood that it was for rendering reasons in the docs. Going back to a property is fine ? |
That was the motivation.
Property only are usable on instances (so that's not possible). Note that this PR documents |
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
sorry I meant class attribute (that is as it was before). Anyway the rendering looks good |
There are compilation issues with scipy-dev that are being fixed in #26771. It's not relevant to this PR, let's merge. |
…cikit-learn#26754) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
…cikit-learn#26754) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
…26754) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
…cikit-learn#26754) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Reference Issues/PRs
Fixes #26742.
What does this implement/fix? Explain your changes.
#25482 made
{Ball,KD}Tree.valid_metrics
private and wrongly created an eponymous class-method. This is a wrong API breaking change.This PR revert parts of #25482 and adaptions introduced in HDBSCAN to make
{Ball,KD}Tree.valid_metrics
public class attributes.It also documents
{Ball,KD}Tree.valid_metrics
.Any other comments?