Skip to content

Conversation

@glemaitre
Copy link
Member

Reverting #5802
Remove casting introduced in #5802 and raise an error due to faulty estimator.

@agramfort @jnothman

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

I guess so. But surely we would need similar checks in other ensembles?

@glemaitre
Copy link
Member Author

I guess so. But surely we would need similar checks in other ensembles?

Shall we impose that any estimators (classifiers + regressors): an estimator should predict something of the same type than y. It could be check in predict and tested in common test. Is there any estimator not allowing for such behaviour?

@jnothman
Copy link
Member

jnothman commented Jun 9, 2017 via email

@agramfort
Copy link
Member

travis is not happy

maybe there is an update to do in what's new?

@amueller
Copy link
Member

amueller commented Jun 10, 2017

So common tests check that the output classes are exactly the same types as the output classes, i.e. do a label encoder or equivalent inside. That means that if you input float, it will output float.

We actually allow floats that encode integers as targets (see type_of_target), so you can run a classifier on something like np.array([1, 2, 3], dtype='float'), and then you will run into this error.

I don't think we need this test because a Classifier that internally doesn't to a LabelEncoder scheme is not a valid sklearn estimator and won't pass check_estimator.

@amueller
Copy link
Member

[Theoretically an estimator could satisfy check_estimator by remapping strings correctly but always casting ints to floats in the output, but that seems like a weird edge case. We could add an additional check to check_estimators, but I think that's overkill]

@glemaitre
Copy link
Member Author

@agramfort @amueller I don't think there is a need for a what's new.
waiting for green lights otherwise should be good

@amueller
Copy link
Member

LGTM

@amueller amueller changed the title [MRG] FIX/TST revert #5802 and raise error for faulty classifier [MRG + 1] FIX/TST revert #5802 and raise error for faulty classifier Jun 10, 2017
@raghavrv raghavrv merged commit 689f412 into scikit-learn:master Jun 10, 2017
@raghavrv
Copy link
Member

Thanks @glemaitre 🎉

Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
… classifier (scikit-learn#9063)

* FIX/TST revert scikit-learn#5802 and raise error for faulty classifier

* FIX check_estimator take care of the rest
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