-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[WIP] gamma=auto in SVC #8361 #8535
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
X, y = [[0.0], [1.0]], [0, 1] | ||
|
||
msg = ("The default gamma parameter value 'auto', calculated as 1 / n_features," | ||
" is depreciated in version 0.19 and will be replaced by '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.
we use "deprecated" not "depreciated"
|
||
clf = svm.SVC(gamma='scale').fit(X, y) | ||
assert_equal(clf._gamma, 2.0) | ||
|
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.
there should be a newline at the end fo the file.
X, y = [[0.0], [1.0]], [0, 1] | ||
|
||
clf = svm.SVC(gamma='scale').fit(X, y) | ||
assert_equal(clf._gamma, 2.0) |
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.
please check for more than one X
|
||
assert_warns_message(DeprecationWarning, | ||
msg, | ||
svm.SVC(gamma='auto').fit, X, y) |
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.
But this means that a user can't intentionally pass 'auto' without receiving a warning, which isn't great. We could solve this by making the default actually 'auto_deprecated'
which behaves like 'auto' with a warning. Using 'auto' explicitly would be same without warning.
@@ -309,7 +309,7 @@ def test_oob_score_classification(): | |||
iris.target, | |||
random_state=rng) | |||
|
|||
for base_estimator in [DecisionTreeClassifier(), SVC()]: | |||
for base_estimator in [DecisionTreeClassifier(), SVC(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.
@neokt are you working on completing this? I just learnt about SVM's so, I can try to get this complete on top of your commits, if you don't plan on working on this. |
Thanks for the heads up. I'll try complete it. |
Reference Issue
Addresses #8361
What does this implement/fix? Explain your changes.
Deprecates the default SVC gamma parameter value of "auto", which is calculated as 1 / n_features, and introduces "scale", which is calculated as 1 / (n_features * X.std()).
Any other comments?
Could not run nosetests due to problems with Conda environent. There are potentially other occurrences of SVC() that need to be updated to SVC(gamma="scale") to avoid Deprecation Warnings associated with SVC(gamma = "auto"). Submitting pull request to locate errors.