Skip to content

FIX RandomForestRegressor OOB fails with integer-values multiple targets - #27817

Merged
thomasjpfan merged 15 commits into
scikit-learn:mainfrom
danieleongari:fix/issue_27814
Nov 25, 2023
Merged

FIX RandomForestRegressor OOB fails with integer-values multiple targets#27817
thomasjpfan merged 15 commits into
scikit-learn:mainfrom
danieleongari:fix/issue_27814

Conversation

@danieleongari

@danieleongari danieleongari commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

Fixes #27814

Allow to compute the OOB score with RandomForestRegressor and an integral multi-target regression.

@github-actions

github-actions Bot commented Nov 20, 2023

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 83a512e. Link to the linter CI: here

@danieleongari danieleongari changed the title fix issue #27814 Fix issue #27814: RandomForestRegressor OOB fails with integer-values multiple targets Nov 21, 2023
Comment thread sklearn/ensemble/_forest.py
Comment thread doc/whats_new/v1.4.rst Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
@glemaitre glemaitre changed the title Fix issue #27814: RandomForestRegressor OOB fails with integer-values multiple targets FIX RandomForestRegressor OOB fails with integer-values multiple targets Nov 22, 2023
@glemaitre

Copy link
Copy Markdown
Member

The failure reported was only some failure related to codecov failing to upload the coverage report.

@danieleongari

Copy link
Copy Markdown
Contributor Author

Thanks @glemaitre for the fast review: I addressed all your concerns.

@glemaitre
glemaitre self-requested a review November 23, 2023 09:40

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple of comments to improve the tests.

Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py
@danieleongari

danieleongari commented Nov 23, 2023

Copy link
Copy Markdown
Contributor Author

Hi @glemaitre,
I'm now computing from scratch the OOB prediction for nsamples_test=3 samples (not all, for sake of time) and comparing with estimator.oob_prediction_[:nsamples_test].

Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just small changes for following the convention naming that we usually use. Otherwise, LGTM. Thanks @danieleongari

Adding a label to request a second review.

Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
@glemaitre glemaitre added the Waiting for Second Reviewer First reviewer is done, need a second one! label Nov 24, 2023
@danieleongari

danieleongari commented Nov 24, 2023

Copy link
Copy Markdown
Contributor Author

All suggestions by @glemaitre implemented in the last commit, thanks!

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the PR @danieleongari !

Comment thread sklearn/ensemble/tests/test_forest.py
Comment thread sklearn/ensemble/tests/test_forest.py
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread sklearn/ensemble/tests/test_forest.py Outdated
Comment thread doc/whats_new/v1.4.rst Outdated
@danieleongari

Copy link
Copy Markdown
Contributor Author

thanks @glemaitre @thomasjpfan. All comments have been addressed.

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan
thomasjpfan merged commit 94f0d6a into scikit-learn:main Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ensemble Waiting for Second Reviewer First reviewer is done, need a second one!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RandomForestRegressor having problem with integer-values targets: The type of target cannot be used to compute OOB estimates

3 participants