8000 [MRG] API make load_* args in datasets kwarg only by adrinjalali · Pull Request #16719 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] API make load_* args in datasets kwarg only #16719

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
merged 9 commits into from
Apr 27, 2020

Conversation

adrinjalali
Copy link
Member

A part of #15005

This PR makes the dataset loader functions kwonly mostly.

I'm not quite certain about a few of them though.

TODO: fix the decorator for functions

ping @thomasjpfan

@jnothman jnothman changed the title [WIP] API male load_* args in datasets kwarg only [WIP] API make load_* args in datasets kwarg only Mar 19, 2020
@thomasjpfan
Copy link
Member

The keyword only syntax seems like it needs defaults values in general

def hello(a, b, *, c):
    print(a, b, c)

hello(1, 2)
# TypeError

hello(1, 2, c=10)
# Works

def hello2(a, b, *, c=10):
    print(a, b, c)

hello2(10, 2)
# Works

Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

This lgtm. What stops it being mrg?

@thomasjpfan
Copy link
Member

This PR needs #16850 to get merge so it can work with:

def make_sparse_coded_signal(n_samples, n_components, *, n_features,
                             n_nonzero_coefs, random_state=None):
    ...

@NicolasHug
Copy link
Member

Looks like this one is ready for an update @adrinjalali ?

@adrinjalali
Copy link
Member Author

all green.

@adrinjalali adrinjalali changed the title [WIP] API make load_* args in datasets kwarg only [MRG] API make load_* args in datasets kwarg only Apr 23, 2020
Comment on lines +21 to +23
y, X, gamma = make_sparse_coded_signal(n_samples=n_targets,
n_components=n_features,
n_features=n_samples,
Copy link
Member

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 weird, was the test correct in the first place? Should we change the variables names?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if it was correct, my gut feeling is that no. But this still passes the test.

Copy link
Member

Choose a reason for hiding this comment

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

If it passes when re-ordering the args then we should rather do that

I can take over if you're busy with other release stuff, LMK

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd be happy if you take over :)

Copy link
Member

Choose a reason for hiding this comment

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

Well, I tried. A few asserts fail in the test even after switching the values. Just gonna approve as is then

@NicolasHug NicolasHug added this to the 0.23 milestone Apr 27, 2020
Copy link
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.

One thought on make_sparse_coded_signal

Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>
@thomasjpfan thomasjpfan merged commit 1ba0651 into scikit-learn:master Apr 27, 2020
@adrinjalali adrinjalali deleted the kwarg/datasets branch April 27, 2020 18:42
@adrinjalali
Copy link
Member Author

tagging #17010

adrinjalali added a commit that referenced this pull request Apr 30, 2020
* API male load_* args in datasets kwarg only

* more loaders

* pep8

* fix test_omp usage

* fix some usages

* Update sklearn/datasets/_samples_generator.py

Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Thomas J Fan <thomasjpfan@gmail.com>
gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
* API male load_* args in datasets kwarg only

* more loaders

* pep8

* fix test_omp usage

* fix some usages

* Update sklearn/datasets/_samples_generator.py

Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Thomas J Fan <thomasjpfan@gmail.com>
viclafargue pushed a commit to viclafargue/scikit-learn that referenced this pull request Jun 26, 2020
* API male load_* args in datasets kwarg only

* more loaders

* pep8

* fix test_omp usage

* fix some usages

* Update sklearn/datasets/_samples_generator.py

Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Thomas J Fan <thomasjpfan@gmail.com>
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
0