Skip to content

[MRG + 1] raise AttributeError in SVC.coef_ for proper duck-typing #8009

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 1 commit into from
Dec 9, 2016

Conversation

amueller
Copy link
Member

@amueller amueller commented Dec 7, 2016

The replaces a ValueError in SVC with an AttributeError which allows duck-typing of coef_.

This issue breaks #5515 and #7618.

Should this have a whatsnew?

@jnothman
Copy link
Member

jnothman commented Dec 8, 2016

Can you briefly explain the relation to #5515 and #7618?

@tguillemot
Copy link
Contributor

I assume that there is some catch in the case of AttributeError. Am I right ?

@tguillemot
Copy link
Contributor

LGTM anyway because it seems more an AttributeError than a ValueError.

@amueller
Copy link
Member Author

amueller commented Dec 8, 2016

@jnothman both of the PRs try to find out if theres a coef_ (which implies a linear model of some sort) and then do something with it.
With master hasattr(SVC().fit(X_train, y_train), "coef_") raises a ValueError, with this PR it returns False.

@amueller amueller changed the title [MRG] raise AttributeError in SVC.coef_ for proper duck-typing [MRG + 1] raise AttributeError in SVC.coef_ for proper duck-typing Dec 8, 2016
@jnothman
Copy link
Member

jnothman commented Dec 9, 2016

LGTM

@jnothman jnothman merged commit 9811b3b into scikit-learn:master Dec 9, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 10, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 15, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 16, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 16, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 22, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 26, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 27, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Dec 27, 2016
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Jan 9, 2017
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Jan 9, 2017
libsvm driver update
Implemented the SVDD estimator in the svm module
Added descriptions of the SVDD and One-Class SVM models, and an example
Reparametrized the SVDD-L1 to take nu instead of C
Updated the docs with the nu reparametrization of the SVDD
FIX: fixed incorrect objective for the nu=1 case in solve_svdd_l1()
Merged the SVDD decision function with that of One-Class SVM
DOC: references and stylistic improvements
TST added unit tests for the SVDD
TST added sparse-dense test for the SVDD
DOC improved the documentation
PEP8: moved the print after the imports in the example
documentation fixes suggested by albertcthomas
minor fixes related to docstrings and comments
TST: unit test fix related to scikit-learn#8009
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Jan 19, 2017
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Jan 19, 2017
libsvm driver update
Implemented the SVDD estimator in the svm module
Added descriptions of the SVDD and One-Class SVM models, and an example
Reparametrized the SVDD-L1 to take nu instead of C
Updated the docs with the nu reparametrization of the SVDD
FIX: fixed incorrect objective for the nu=1 case in solve_svdd_l1()
Merged the SVDD decision function with that of One-Class SVM
DOC: references and stylistic improvements
TST added unit tests for the SVDD
TST added sparse-dense test for the SVDD
DOC improved the documentation
PEP8: moved the print after the imports in the example
documentation fixes suggested by albertcthomas
minor fixes related to docstrings and comments
TST: unit test fix related to scikit-learn#8009
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Jan 31, 2017
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Feb 7, 2017
ivannz added a commit to ivannz/scikit-learn that referenced this pull request Feb 7, 2017
libsvm driver update
Implemented the SVDD estimator in the svm module
Added descriptions of the SVDD and One-Class SVM models, and an example
Reparametrized the SVDD-L1 to take nu instead of C
Updated the docs with the nu reparametrization of the SVDD
FIX: fixed incorrect objective for the nu=1 case in solve_svdd_l1()
Merged the SVDD decision function with that of One-Class SVM
DOC: references and stylistic improvements
TST added unit tests for the SVDD
TST added sparse-dense test for the SVDD
DOC improved the documentation
PEP8: moved the print after the imports in the example
documentation fixes suggested by albertcthomas
minor fixes related to docstrings and comments
TST: unit test fix related to scikit-learn#8009
sergeyf pushed a commit to sergeyf/scikit-learn that referenced this pull request Feb 28, 2017
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
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.

3 participants