Skip to content

API: do we allow a list of generic objects as X? #16130

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

Open
adrinjalali opened this issue Jan 15, 2020 · 8 comments
Open

API: do we allow a list of generic objects as X? #16130

adrinjalali opened this issue Jan 15, 2020 · 8 comments
Labels

Comments

@adrinjalali
Copy link
Member

#15557 introduced a change in the GP module to allow a list of generic objects and kernels on those data, which is nice, but it violates our API AFAIK.

If we're going to allow that, there are many other places we can/should allow that as well (SVMs for instance).

But that doesn't really play well with the rest of the library (pipeline, GS, etc).

ping @scikit-learn/core-devs

@NicolasHug
Copy link
Member

For reference, the HMM module was removed precisely because of API incompatibility reasons.

@jnothman
Copy link
Member

jnothman commented Jan 15, 2020 via email

@jnothman
Copy link
Member

jnothman commented Jan 15, 2020 via email

@GaelVaroquaux
Copy link
Member

GaelVaroquaux commented Jan 15, 2020 via email

@NicolasHug
Copy link
Member

I may be missing something, but it seems to me that #15557 makes the GPs partially incompatible with GridSearchCV or even simply cross-validation. How do you split an array of arbitrary shaped samples?

@TomDLT
Copy link
Member

TomDLT commented Jan 22, 2020

An array of arbitrary shaped samples is still an array, so it should work well with _num_samples and _safe_indexing.

def _num_samples(x):
"""Return number of samples in array-like x."""

def _safe_indexing(X, indices, axis=0):
"""Return rows, items or columns of X using indices.

@adrinjalali
Copy link
Member Author

we should be consistent then. Right now we have:

$ git grep "X\.shape\[0\]" sklearn/ | wc
    464    2434   39250

@jnothman
Copy link
Member

jnothman commented Jan 22, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants