-
-
Notifications
You must be signed in to change notification settings - Fork 26k
API Deprecate positional arguments in svm module #16973
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
API Deprecate positional arguments in svm module #16973
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.
LGTM either way.
@@ -627,7 +629,8 @@ class SVC(BaseSVC): | |||
|
|||
_impl = 'c_svc' | |||
|
|||
def __init__(self, C=1.0, kernel='rbf', degree=3, gamma='scale', | |||
@_deprecate_positional_args | |||
def __init__(self, *, C=1.0, kernel='rbf', degree=3, 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 would leave C
and nu
positional, I think, but no strong preference.
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 not. Too unclear with SVC(0.5)
@@ -627,7 +629,8 @@ class SVC(BaseSVC): | |||
|
|||
_impl = 'c_svc' | |||
|
|||
def __init__(self, C=1.0, kernel='rbf', degree=3, gamma='scale', | |||
@_deprecate_positional_args | |||
def __init__(self, *, C=1.0, kernel='rbf', degree=3, 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 not. Too unclear with SVC(0.5)
@@ -992,7 +996,8 @@ class SVR(RegressorMixin, BaseLibSVM): | |||
|
|||
_impl = 'epsilon_svr' | |||
|
|||
def __init__(self, kernel='rbf', degree=3, gamma='scale', | |||
@_deprecate_positional_args | |||
def __init__(self, *, kernel='rbf', degree=3, 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'd consider kernel
being positional in SVMs... but SVC has C
in the way.
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.
Maybe that's something we can do once the deprecation cycle is over, because there would be no risk of breaking user code?
sklearn/svm/_classes.py
Outdated
def __init__(self, penalty='l2', loss='squared_hinge', dual=True, tol=1e-4, | ||
C=1.0, multi_class='ovr', fit_intercept=True, | ||
@_deprecate_positional_args | ||
def __init__(self, penalty='l2', *, loss='squared_hinge', dual=True, |
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.
any reason to make penalty positional but not the loss?
I feel like both are equally unambiguous given the possible names
@@ -992,7 +996,8 @@ class SVR(RegressorMixin, BaseLibSVM): | |||
|
|||
_impl = 'epsilon_svr' | |||
|
|||
def __init__(self, kernel='rbf', degree=3, gamma='scale', | |||
@_deprecate_positional_args | |||
def __init__(self, *, kernel='rbf', degree=3, 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.
Maybe that's something we can do once the deprecation cycle is over, because there would be no risk of breaking user code?
* API Keyword only for svm * BUG Fix * CLN Address comments
* API Keyword only for svm * BUG Fix * CLN Address comments
Reference Issues/PRs
Towards #15005
CC @adrinjalali