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

MAINT rename base_estimator and base_estimator_ in ensemble classes #23819

Merged
merged 60 commits into from
Sep 9, 2022

Conversation

EdAbati
Copy link
Contributor

@EdAbati EdAbati commented Jul 2, 2022

Reference Issues/PRs

Closes #9104. See also #22145.
Closes #22145

What does this implement/fix? Explain your changes.

I continued the stalled PR #22145.
I decided to change BaseBagging as initially suggested by @cmarmo #9104, because both BaggingRegressor and BaggingClassifier depend on it. With this, I had to make a small update in the __init__ of the IsolationForest too, since it is also subclass of BaseBagging (I believe I should not make a deprecation cycle here, because estimator is not a argument of IsolationForest, but please correct me if I am wrong).

I should have addressed everything in the comments, but please let me know if I missed anything. :)

Any other comments

With this PR all the classes mentioned here #9104 (comment) should be renamed and (I think) #9104 can be closed

@cmarmo
Copy link
Contributor

cmarmo commented Jul 2, 2022

Hi @EdAbati , thanks for your pull request! And thanks for giving a try to my first suggestion! I like your solution! :D
Do you mind checking in the documentation (the .rst files) if there is any occurrence of base_estimator for Bagging and replacing with estimator? I found one in glossary.rst (line 598) but maybe there are some more. Thanks!

@EdAbati
Copy link
Contributor Author

EdAbati commented Jul 2, 2022

Hi @cmarmo , thank you very much for the fast review.
docs should be updated now! :)

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

In addition, we should add a test for the deprecation of base_estimator_ in test_iforest.py.

doc/whats_new/v1.2.rst Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Show resolved Hide resolved
sklearn/ensemble/tests/test_weight_boosting.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_weight_boosting.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_weight_boosting.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_forest.py Show resolved Hide resolved
sklearn/ensemble/tests/test_base.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Outdated Show resolved Hide resolved
@glemaitre glemaitre changed the title MAINT rename base_estimator to estimator in BaseBagging, BaggingRegressor and BaggingClassifier MAINT rename base_estimator and base_estimator_ in ensemble class Sep 7, 2022
@glemaitre glemaitre added this to the 1.2 milestone Sep 7, 2022
@EdAbati
Copy link
Contributor Author

EdAbati commented Sep 7, 2022

@glemaitre I think I added all your suggestion :)

sklearn/ensemble/tests/test_weight_boosting.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_weight_boosting.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_iforest.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_forest.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Outdated Show resolved Hide resolved
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

I applied my small nitpick suggestion to be inline with our own way to find the deprecation to remove in the future.

On my side, this PR is good to go. We will need a second reviewer.

@glemaitre
Copy link
Member

ping @jeremiedbb @thomasjpfan

@glemaitre glemaitre changed the title MAINT rename base_estimator and base_estimator_ in ensemble class MAINT rename base_estimator and base_estimator_ in ensemble classes Sep 8, 2022
@EdAbati
Copy link
Contributor Author

EdAbati commented Sep 8, 2022

Thank you very much @glemaitre for the help. :)

And apologies for the long back-and-forth, I got a bit confused on what needed to be done. (I hope I didn't make you waste too much time.)

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @EdAbati ! Here are some comments/questions.

sklearn/ensemble/_base.py Show resolved Hide resolved
sklearn/ensemble/_base.py Outdated Show resolved Hide resolved
sklearn/ensemble/_base.py Outdated Show resolved Hide resolved
sklearn/ensemble/_base.py Outdated Show resolved Hide resolved
sklearn/ensemble/_bagging.py Outdated Show resolved Hide resolved
sklearn/ensemble/tests/test_bagging.py Show resolved Hide resolved
@EdAbati
Copy link
Contributor Author

EdAbati commented Sep 8, 2022

Hi @jeremiedbb , thank you for the review! I should have addressed everything.

I have added a fix to the documentation of [RandomTreesEmbedding 2cd0cf2. The docstring said that the estimator used was a ExtraTreeClassifier when it is instead a ExtraTreeRegressor.

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @EdAbati

@jeremiedbb jeremiedbb merged commit 306608e into scikit-learn:main Sep 9, 2022
@glemaitre
Copy link
Member

Nice thanks @EdAbati

@EdAbati EdAbati deleted the rename-base-estimator branch September 9, 2022 11:41
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Sep 12, 2022
…n ensemble classes (scikit-learn#23819)

Co-authored-by: Adrian Trujillo Duron <adrian.td96@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

base_estimator vs estimator for meta-estimators
5 participants