-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[MRG+1] allow callable kernels in cross-validation #8005
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
Conversation
This seems more sensible... but I'd like to hear whether there are reasons other than computational cost that others can find for this restriction existing in the first place. |
In short, LGTM |
weird I didn't get the error locally... must have not run the test properly.. |
I have no idea why I put |
I had it put in metaestimator, because it began being used in multiple
places (OvO, I think) by metaestimatory things. Maybe it belongs in a
general utils module.
…On 8 December 2016 at 10:04, Andreas Mueller ***@***.***> wrote:
I have no idea why I put _safe_split into utils.meta_estimator, but I
don't really have a better idea now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8005 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz68MZc_9M7_7P0yw6eOs2RCos6JrEks5rFztqgaJpZM4LHN1t>
.
|
At least it's got an underscore before it so we can move it wherever we
like!
…On 8 December 2016 at 12:53, Joel Nothman ***@***.***> wrote:
I had it put in metaestimator, because it began being used in multiple
places (OvO, I think) by metaestimatory things. Maybe it belongs in a
general utils module.
On 8 December 2016 at 10:04, Andreas Mueller ***@***.***>
wrote:
> I have no idea why I put _safe_split into utils.meta_estimator, but I
> don't really have a better idea now.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#8005 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAEz68MZc_9M7_7P0yw6eOs2RCos6JrEks5rFztqgaJpZM4LHN1t>
> .
>
|
(I wonder whether kallable kernels were outlawed at some point when joblib didn't check for picklability and things crashed??) |
for reference, from sklearn.model_selection import cross_val_score
from sklearn.svm import SVC
from sklearn.datasets import make_blobs
import numpy as np
X, y = make_blobs()
cross_val_score(SVC(kernel=lambda x, y: np.inner(x, y)), X, y) works, |
Thanks for the exemple @amueller. |
Maybe we can add something about that in what's new ? |
this is good for merge, right? |
This allows callable kernels in cross-validation.
This was forbidden in #649 but I don't understand why.
I kept it in #803 when I introduced
_pairwise
for some reason.Discussion in #7930 where @jnothman and me got kinda confused I think.
Removing the condition in
metaestimators.py
does not break any tests.I checked all other occurrences of
_pairwise
and it only returnsTrue
for"precomputed"
, never for callable.s