Skip to content
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

[MRG] Make CalibratedClassifierCV a MetaEstimator #13575

Merged

Conversation

wdevazelhes
Copy link
Contributor

@wdevazelhes wdevazelhes commented Apr 4, 2019

See #13485 (comment)

This PR makes CalibratedClassifierCV a MetaEstimator
It's WIP because I think it makes sense to do that, but I still need to understand what will it change, and see what are unexpected consequences, and add non-regression tests if needed.

Copy link
Member

@agramfort agramfort left a comment

it should be the case indeed +1

@wdevazelhes
Copy link
Contributor Author

@wdevazelhes wdevazelhes commented Apr 4, 2019

Looking at this comment: #13077 (comment), it seemed that before some tests were not run on MetaEstimators, which would mean we would need to add them in the tests ran on CalibratedClassifierCV
But now test_non_meta_estimators appears to have been deleted in #8022, so I think in fact I don't need to add the tests, since now MetaEstimatorsMixin are considered as regular estimators ?

@wdevazelhes
Copy link
Contributor Author

@wdevazelhes wdevazelhes commented Apr 4, 2019

I just added a what's new entry, though I'm not sure whether I should have put the first one (about the MetaEstimator, since it maybe doesn't change anything for the users ?)

@wdevazelhes
Copy link
Contributor Author

@wdevazelhes wdevazelhes commented Apr 4, 2019

Also, about the bug fix, I don't think I need to provide a non-regression test since the test is already "added" thanks to the discovery of the tests for MetaEstimators, but tell me if otherwise

@@ -68,6 +68,15 @@ Support for Python 3.4 and below has been officially dropped.
between 0 and 1.
:issue:`13086` by :user:`Scott Cole <srcole>`.

- |Enhancement| Made `calibration.CalibratedClassifierCV` inherit from
Copy link
Member

@jnothman jnothman Apr 4, 2019

Choose a reason for hiding this comment

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

This change isn't user facing. No need to litter the change log with such things IMO.

Copy link
Contributor Author

@wdevazelhes wdevazelhes Apr 4, 2019

Choose a reason for hiding this comment

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

I agree, done

@wdevazelhes wdevazelhes changed the title [WIP] Make CalibratedClassifierCV a MetaEstimator [MRG] Make CalibratedClassifierCV a MetaEstimator Apr 4, 2019
@glemaitre glemaitre self-assigned this Apr 23, 2019
@@ -172,6 +174,7 @@ def fit(self, X, y, sample_weight=None):
warnings.warn("%s does not support sample_weight. Samples"
" weights are only used for the calibration"
" itself." % estimator_name)
sample_weight = check_array(sample_weight, ensure_2d=False)
Copy link
Contributor

@glemaitre glemaitre Apr 23, 2019

Choose a reason for hiding this comment

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

Uhm how it can be a bug since that sample_weight will not be given to the underlying estimator. Do I miss something?

Copy link
Member

@qinhanmin2014 qinhanmin2014 Jul 13, 2019

Choose a reason for hiding this comment

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

We sill need to pass sample_weight to _CalibratedClassifier

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a comment

We don't have a test right? but OK.

@qinhanmin2014 qinhanmin2014 merged commit 979c761 into scikit-learn:master Jul 13, 2019
16 checks passed
@wdevazelhes
Copy link
Contributor Author

@wdevazelhes wdevazelhes commented Jul 15, 2019

Thanks for the review @qinhanmin2014 and @glemaitre ! I realized that the what's new entry is in v.0.21, should I revert this PR and move it to 0.22 ? Should I add a test too ? Like check with a 3D array for instance that it works ?

@qinhanmin2014
Copy link
Member

@qinhanmin2014 qinhanmin2014 commented Jul 15, 2019

I realized that the what's new entry is in v.0.21, should I revert this PR and move it to 0.22?

thanks, I'll push a commit.

Should I add a test too?

Not sure, at least I'm OK to merge without a test.

@wdevazelhes
Copy link
Contributor Author

@wdevazelhes wdevazelhes commented Jul 15, 2019

All right, thanks !

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.

None yet

5 participants