Skip to content

API kwonly for neighbors module#17004

Merged
NicolasHug merged 7 commits intoscikit-learn:masterfrom
NicolasHug:kwonly_neighbors
Apr 24, 2020
Merged

API kwonly for neighbors module#17004
NicolasHug merged 7 commits intoscikit-learn:masterfrom
NicolasHug:kwonly_neighbors

Conversation

@NicolasHug
Copy link
Copy Markdown
Member

Towards #15005


def __init__(self, n_neighbors=5, radius=1.0,
@_deprecate_positional_args
def __init__(self, *, n_neighbors=5, radius=1.0,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this one is a bit special because it has both n_neighbors and radius so I make both kwonly but feel free to disagree

Copy link
Copy Markdown
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

and checks failing.

"""
def __init__(self, mode='distance', n_neighbors=5, algorithm='auto',
@_deprecate_positional_args
def __init__(self, mode='distance', n_neighbors=5, *, algorithm='auto',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd leave no positional here. KNeighborsTransformer('distance', 5) doesn't really read well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, we probably should have put n_neighbors first.

"""
def __init__(self, mode='distance', radius=1., algorithm='auto',
@_deprecate_positional_args
def __init__(self, mode='distance', radius=1., *, algorithm='auto',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here.

Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Looks good aside from the comments on the *NeighborsTransformers.

@adrinjalali adrinjalali added this to the 0.23 milestone Apr 23, 2020
"""
def __init__(self, mode='distance', n_neighbors=5, algorithm='auto',
@_deprecate_positional_args
def __init__(self, mode='distance', n_neighbors=5, *, algorithm='auto',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, we probably should have put n_neighbors first.

@adrinjalali
Copy link
Copy Markdown
Member

tests still failing

@NicolasHug
Copy link
Copy Markdown
Member Author

This one was weird... tests were all green before except for codecov, then after I merged master I got 30 legit errors because of some kwonly args. No idea why they didn't show up before...

Looks like everything is green now, it's +2 so I'll merge before it goes bad

Thanks for the reviews

@NicolasHug NicolasHug changed the title [MRG] API kwonly for neighbors module API kwonly for neighbors module Apr 24, 2020
@NicolasHug NicolasHug merged commit 2955d9f into scikit-learn:master Apr 24, 2020
@NicolasHug NicolasHug deleted the kwonly_neighbors branch April 24, 2020 18:22
gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
viclafargue pushed a commit to viclafargue/scikit-learn that referenced this pull request Jun 26, 2020
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.

4 participants