Skip to content

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

Merged
merged 3 commits into from
Apr 23, 2020

Conversation

thomasjpfan
Copy link
Member

Reference Issues/PRs

Towards #15005

CC @adrinjalali

@thomasjpfan thomasjpfan added this to the 0.23 milestone Apr 20, 2020
@thomasjpfan thomasjpfan changed the title API Enables keyword only args in svm module API Deprecate positional arguments in svm module Apr 20, 2020
Copy link
Member

@adrinjalali adrinjalali left a 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',
Copy link
Member

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.

Copy link
Member

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',
Copy link
Member

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',
Copy link
Member

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.

Copy link
Member

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?

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,
Copy link
Member

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',
Copy link
Member

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?

@adrinjalali adrinjalali merged commit 8010cad into scikit-learn:master Apr 23, 2020
gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
* API Keyword only for svm

* BUG Fix

* CLN Address comments
ivannz added a commit to ivannz/scikit-learn that referenced this pull request May 30, 2020
viclafargue pushed a commit to viclafargue/scikit-learn that referenced this pull request Jun 26, 2020
* API Keyword only for svm

* BUG Fix

* CLN Address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants