-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
ENH Warn on irrelevant parameters for linear kernel in SVC #30174
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also would need tests, a starting point was provided in #19630
… into svm-warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need a commit with a [doc build]
in the commit message to make sure our docs don't raise these errors.
@@ -217,7 +217,25 @@ def fit(self, X, y, sample_weight=None): | |||
"X and y have incompatible shapes.\n" | |||
+ "X has %s samples, but y has %s." % (n_samples, y.shape[0]) | |||
) | |||
|
|||
if self.kernel == "linear": | |||
if self.gamma != "scale": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's odd to check for the default value here, since the user might be setting these default values explicitly. One alternative is to have the default value as None
, and here check if it's None
.
Then it begs the question, do we automatically assign a default value to gamma
when it's None
or not. As a consequence, the question becomes, should this be valid code?
SVC(kernel="rbf")
Or should the user always give a gamma
as:
SVC(kernel="rbf", gamma=.1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrinjalali I think it's better to require a value of gamma
to be clearly specified. Since the default value is already None
, we might not want to have another default value when None
is chosen. For me it's strange to have two default values for a single function call.
Reference Issues/PRs
closes #28641
closes #19630
Fixes #19614
What does this implement/fix? Explain your changes.
Add user warnings when irrelevant parameters are set for linear kernel
Any other comments?