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

MNT Deprecate {n_}classes_ attribute for tree regressors #15028

Merged
merged 28 commits into from Sep 20, 2019

Conversation

@adrinjalali
Copy link
Member

adrinjalali commented Sep 19, 2019

Closes #14935.
Closes #14803

@NicolasHug I think we should also deprecate n_classes_ at the same time.

I also figured the Tree object requires the n_classes_ which doesn't make much sense at all.

I didn't touch the tree.pyx, but that needs to be fixed.

WDYT?

meiguan and others added 25 commits Aug 24, 2019
meiguan
meiguan
meiguan
meiguan
meiguan
meiguan
meiguan
meiguan
Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>
…p_classes_tree_regressor
@NicolasHug

This comment has been minimized.

Copy link
Contributor

NicolasHug commented Sep 19, 2019

Yeah I'm fine with that. LGTM if all goes green

@@ -1695,7 +1695,9 @@ def _run_search(self, evaluate):
for attr in dir(gscv):
if attr[0].islower() and attr[-1:] == '_' and \
attr not in {'cv_results_', 'best_estimator_',
'refit_time_'}:
'refit_time_',
'classes_' # TODO: remove in 0.24

This comment has been minimized.

Copy link
@amueller

amueller Sep 19, 2019

Member

This seems a very weird thing to do. Why not catch the deprecation warning and keep the equality test?

This comment has been minimized.

Copy link
@adrinjalali

adrinjalali Sep 20, 2019

Author Member

ok, catching the warning now

assert n == clf.n_outputs_

with pytest.warns(DeprecationWarning, match=match):
clf.n_classes_

This comment has been minimized.

Copy link
@glemaitre

glemaitre Sep 20, 2019

Contributor

You can have an additional assert for the value

This comment has been minimized.

Copy link
@adrinjalali

adrinjalali Sep 20, 2019

Author Member

ok, done.

@glemaitre

This comment has been minimized.

Copy link
Contributor

glemaitre commented Sep 20, 2019

I am +1 for this version since we deprecate n_classes_ as well which make sense.

@glemaitre glemaitre added this to TO BE MERGED in Guillaume's pet Sep 20, 2019
adrinjalali added 3 commits Sep 20, 2019
@NicolasHug

This comment has been minimized.

Copy link
Contributor

NicolasHug commented Sep 20, 2019

Thanks Adrin

@NicolasHug NicolasHug merged commit 186629b into scikit-learn:master Sep 20, 2019
19 checks passed
19 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 artifact Link to 0/doc/_changed.html
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 95.99%)
Details
codecov/project 96.75% (+0.76%) compared to 78c06e5
Details
scikit-learn.scikit-learn Build #20190920.20 succeeded
Details
scikit-learn.scikit-learn (Linux py35_conda_openblas) Linux py35_conda_openblas succeeded
Details
scikit-learn.scikit-learn (Linux py35_ubuntu_atlas) Linux py35_ubuntu_atlas succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_conda_mkl) Linux pylatest_conda_mkl succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_pip_openblas_pandas) Linux pylatest_pip_openblas_pandas succeeded
Details
scikit-learn.scikit-learn (Linux32 py35_ubuntu_atlas_32bit) Linux32 py35_ubuntu_atlas_32bit succeeded
Details
scikit-learn.scikit-learn (Windows py35_pip_openblas_32bit) Windows py35_pip_openblas_32bit succeeded
Details
scikit-learn.scikit-learn (Windows py37_conda_mkl) Windows py37_conda_mkl succeeded
Details
scikit-learn.scikit-learn (macOS pylatest_conda_mkl) macOS pylatest_conda_mkl succeeded
Details
@glemaitre glemaitre moved this from TO BE MERGED to MERGED in Guillaume's pet Sep 23, 2019
@adrinjalali adrinjalali deleted the adrinjalali:dep_classes_tree_regressor branch Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4 participants
You can’t perform that action at this time.