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 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 left a comment

it should be the case indeed +1

@wdevazelhes

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
@jnothman

jnothman Apr 4, 2019

Member

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

This comment has been minimized.

Copy link
@wdevazelhes

wdevazelhes Apr 4, 2019

Author Contributor

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)

This comment has been minimized.

Copy link
@glemaitre

glemaitre Apr 23, 2019

Contributor

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

This comment has been minimized.

Copy link
@qinhanmin2014

qinhanmin2014 Jul 13, 2019

Member

We sill need to pass sample_weight to _CalibratedClassifier

Copy link
Member

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
16 checks passed
LGTM analysis: C/C++ No code changes detected
Details
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No new or fixed alerts
Details
ci/circleci: deploy Your tests passed on CircleCI!
Details
ci/circleci: doc Your tests passed on CircleCI!
Details
ci/circleci: doc-min-dependencies Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 96.65%)
Details
codecov/project 96.65% (+<.01%) compared to 93e09aa
Details
scikit-learn.scikit-learn Build #20190404.16 succeeded
Details
scikit-learn.scikit-learn (Linux py35_conda_openblas) Linux py35_conda_openblas succeeded
Details
scikit-learn.scikit-learn (Linux py35_np_atlas) Linux py35_np_atlas succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_conda) Linux pylatest_conda succeeded
Details
scikit-learn.scikit-learn (Windows py35_32) Windows py35_32 succeeded
Details
scikit-learn.scikit-learn (Windows py37_64) Windows py37_64 succeeded
Details
scikit-learn.scikit-learn (macOS pylatest_conda) macOS pylatest_conda succeeded
Details
@wdevazelhes

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Contributor Author

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
Projects
None yet
5 participants
You can’t perform that action at this time.