Skip to content

MRG bugfix in SVM: classifier behavior with only one class present - #1009

Merged
ogrisel merged 2 commits into
scikit-learn:masterfrom
amueller:one_class_check
Aug 29, 2012
Merged

ogrisel merged 2 commits into
scikit-learn:masterfrom
amueller:one_class_check

Conversation

@amueller

Copy link
Copy Markdown
Member

This PR checks the behavior of all classifiers regarding training with only one class. The classifier should either yield a constant predictor or raise a sensible error message.

It fixes a bug in the SVMs which yielded garbage results (and now raise a ValueError).

@amueller

Copy link
Copy Markdown
Member Author

Btw, this fixes nonsensical behavior of the SVC. It returned something, but not the constant class.

Comment thread sklearn/tests/test_common.py Outdated

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.

can you put a comment to explain why this class is skipped? it this a TODO?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't remember at the moment, So I should check and put in a comment ^^

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed the line. I think my concern was that the data was not multinomial and the estimator might choke. But it just runs through.

@GaelVaroquaux

Copy link
Copy Markdown
Member

Looks good. +1 for merge.

@ogrisel

ogrisel commented Aug 29, 2012

Copy link
Copy Markdown
Member

+1 for merging too.

ogrisel added a commit that referenced this pull request Aug 29, 2012
MRG bugfix in SVM: classifier behavior with only one class present
@ogrisel
ogrisel merged commit 5d73ecd into scikit-learn:master Aug 29, 2012
@amueller

Copy link
Copy Markdown
Member Author

Thanks for review + merge :)

@amueller
amueller deleted the one_class_check branch May 19, 2017 20:46
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