Skip to content

[MRG] Change loss names for LinearSVC and LinearSVR#3933

Merged
larsmans merged 1 commit intoscikit-learn:masterfrom
fabianp:loss_liblinear
Feb 10, 2015
Merged

[MRG] Change loss names for LinearSVC and LinearSVR#3933
larsmans merged 1 commit intoscikit-learn:masterfrom
fabianp:loss_liblinear

Conversation

@fabianp
Copy link
Copy Markdown
Member

@fabianp fabianp commented Dec 4, 2014

the names are now consistent across methods and with the SGD module

In LinearSVC:
'l1' -> 'hinge'
'l2' -> 'squared_hinge'
In LinearSVR:
'l1' -> 'epsilon_insensitive'
'l2' -> 'squared_epsilon_insensitive'

@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Dec 4, 2014

The implementation is backwards compatible, so that the user can still use loss={'l1', 'l2'} in LinearSVC

@mblondel
Copy link
Copy Markdown
Member

mblondel commented Dec 4, 2014

Can you add a test for loss="squared_epsilon_insensitive"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having a hard parsing the meaning of this... care to insert a comment explaining the structure?

@amueller
Copy link
Copy Markdown
Member

amueller commented Dec 4, 2014

I guess we should deprecate the old names then? Is that consistent with SGDClassifier?

@larsmans
Copy link
Copy Markdown
Member

larsmans commented Dec 4, 2014

Or we don't deprecate, and we leave them in-place forever as backwards-compatible synonyms. They're not in the way, are they?

@amueller
Copy link
Copy Markdown
Member

amueller commented Dec 4, 2014

Fine with me, but then they should be documented, right?
If someone sees it used in the code, then looks at the documentation and it is not documented as a legal option, that seems weird.

@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Dec 5, 2014

I agree it should be documented, I'll take care of it (and the failing tests).

@fabianp fabianp changed the title Change loss names for LinearSVC and LinearSVR() [MRG] Change loss names for LinearSVC and LinearSVR() Dec 10, 2014
@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Dec 10, 2014

Fixed the failing test (mostly due to error in doctests). Ready to merge I would say

@larsmans larsmans changed the title [MRG] Change loss names for LinearSVC and LinearSVR() [MRG+1] Change loss names for LinearSVC and LinearSVR Dec 15, 2014
@larsmans
Copy link
Copy Markdown
Member

+1 for merge. I've already cherry-picked the last commit into master.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we that's why we shouldn't do it in the init method ;) actually the common tests should fail if you do it in the __init__. Do they not? The deprecation warning should give the version (0.17?) where it will be removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, missed this one. I too think we should do this in fit and not actually store the translated loss name. Just make sure l1 and hinge cause the same behavior.

@larsmans larsmans changed the title [MRG+1] Change loss names for LinearSVC and LinearSVR [MRG] Change loss names for LinearSVC and LinearSVR Dec 15, 2014
@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Dec 16, 2014

Thanks for your feedback @amueller and @larsmans! I fixed it so that the parameters are converted in the .fit() but the modification is never stored.

@amueller
Copy link
Copy Markdown
Member

👍

@larsmans
Copy link
Copy Markdown
Member

Ehm... it still says the old names are going to disappear in 0.17. Can we really not keep them indefinitely? Or remove in version 1.0 or something?

@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Dec 18, 2014

I really don't mind in what version to deprecate. 1.0 is fine for me.

@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Feb 6, 2015

Changed the removal version to 1.0

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Feb 6, 2015

Fine with me. This PR needs a rebase though.

the names are now consistent across methods

In LinearSVC:
   'l1' -> 'hinge'
   'l2' -> 'squared_hinge'
In LinearSVR:
   'l1' -> 'epsilon_insensitive'
   'l2' -> 'squared_epsilon_insensitive'
@fabianp
Copy link
Copy Markdown
Member Author

fabianp commented Feb 9, 2015

Rebase done

larsmans added a commit that referenced this pull request Feb 10, 2015
MAINT Change loss names for LinearSVC and LinearSVR
@larsmans larsmans merged commit 73e5cf5 into scikit-learn:master Feb 10, 2015
@larsmans
Copy link
Copy Markdown
Member

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants