-
-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Give feedback when svm.SVC
is configured with kernel hyperparameters for a different kernel
#19614
Comments
Thanks for the report, I agree we should even error in this case (instead of a warning), as bug fix. The same goes for PR welcome @PGijsbers |
Currently, I think we should error when the parameter is not the default value and not compatible with the kernel. For example, if |
I'll try to make the changes this weekend 👍 |
Should the error be raised on |
the validation should happen in Also please make sure to write a non-regression test for the cases that are worth testing. The test should make sure that the error is now properly raised. Your snippet above is a great candidate. Thanks! |
This change breaks some tests, e.g. sparse_svm. I'll go ahead and update those? Should I raise a DeprecationWarning first, or immediately setup a PR with ValueErrors? |
I would prefer to deprecated first to be on the safe side. For the first PR, let's do this for |
I don't think there's anything to deprecate here: there's no feature, just a silent (minor) bug. We could raise a temporary warning instead of an error, but for such bugfixes we tend to error directly. On top of that, the upcoming release is 1.0, so it'd be nice to include such changes directly. Also, the failing tests as mentioned above would have to fixed whether we raise a warning or an error. |
I'll update the PR when there is a new consensus (the PR has a |
@thomasjpfan what made you change your mind from error to warning? The offending test sparse_svm is clearly wrong as it passes |
I agree with Nicolas: the test is just being lazy.
|
The ignoring behavior is explicitly documented which makes me think it was intentional. I do want to get to raising an error at some point and would be +1 on raising an error for 1.0. |
Why not just go through the usual deprecation cycle? This is more user friendly than a breaking change. |
The fact that the degree parameter is documented as ignored explicitly if kernel is not poly is a marker that the current behavior was intentional and should therefore not be considered a bug. Also the current behavior can be (ab-)used to do simple yet efficient hyper-parameter search for all the kernel and there parametrizations at once using Also, to be consistent, we should do the same for all 3 parameters ( Also we should also issue the Since |
Raising an error will not be an issue with
I assume that we want to be consistent. But indeed getting So I assume that we are left with:
I am +0 on this. @ogrisel @NicolasHug @NicolasHug could you give a bit more thoughts and say what you think is best? |
Looking at this again, if we were to change behavior, I am +1 on deprecation.
Maybe that is a good thing? Currently, one needs to read the docs to know if the parameter is even active.
I think the current implementation is less efficient, because one can have search spaces with parameters that are ignored. I am +0.5 on deprecating the current behavior. |
So the deprecation could be a good option. @thomasjpfan what are your thoughts regarding the
|
Using |
During our class we noticed some students incorrectly configure some hyperparameters which are irrelevant to the kernel used, for example setting
gamma
when using a linear kernel. We think it could make sense for scikit-learn to give feedback to the user when non-effective settings are configured.Describe the workflow you want to enable
current output:
proposed output, something similar to:
The text was updated successfully, but these errors were encountered: