Add Out-of-Bag (OOB) Score Support to RandomForest#7401
Merged
rapids-bot[bot] merged 41 commits intorapidsai:mainfrom Nov 3, 2025
Merged
Add Out-of-Bag (OOB) Score Support to RandomForest#7401rapids-bot[bot] merged 41 commits intorapidsai:mainfrom
rapids-bot[bot] merged 41 commits intorapidsai:mainfrom
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test ba0c33a |
83224e2 to
bb46ce7
Compare
Contributor
Author
|
/ok to test 25ab340 |
Contributor
Author
|
/ok to test c349e02 |
Not needed since we can trigger the bootstrap_mask storage by providing a non-null pointer.
c349e02 to
4dcfd8c
Compare
Contributor
Author
|
/ok to test 4dcfd8c |
viclafargue
approved these changes
Oct 31, 2025
Contributor
viclafargue
left a comment
There was a problem hiding this comment.
Thanks for working on this! LGTM, just some minor suggestions for the Python portion.
…::par.on." This reverts commit 5dae6a5.
divyegala
approved these changes
Oct 31, 2025
jcrist
approved these changes
Oct 31, 2025
Member
jcrist
left a comment
There was a problem hiding this comment.
LGTM, nice work! Left two small nits, but otherwise
!
Contributor
Author
|
/merge |
vardhan30016
pushed a commit
to vardhan30016/cuml
that referenced
this pull request
Nov 7, 2025
## Summary Implements out-of-bag (OOB) scoring for `RandomForestClassifier` and `RandomForestRegressor`, enabling users to estimate model performance without requiring a separate validation set. Closes rapidsai#7395 ## Changes ### C++ Layer - Modified `fit()` functions to accept optional `bootstrap_masks` parameter for storing per-tree bootstrap sample indicators - Updated `RandomForest::fit()` to capture and store bootstrap masks when `oob_score=True` ### Python Layer - Added `oob_score` parameter (boolean only) to Random Forest estimators - Implemented `_compute_oob_score()` method that leverages FIL's `predict_per_tree()` for efficient OOB predictions - Added `oob_score_` and `oob_decision_function_` (or `oob_prediction_`) attributes - Validates that `oob_score` is boolean (custom scorer functions not supported) - Added proper attribute transfer for pickle and CPU interop ### Metrics - **Classifier**: Uses accuracy score on OOB predictions - **Regressor**: Uses R² score on OOB predictions ## Limitations - Custom scorer functions (callable `oob_score`) are not supported - only boolean values accepted - Multi-output targets not supported for OOB scoring ## Testing Added comprehensive tests covering: - Binary and multi-class classification OOB scoring - Regression OOB scoring - Error handling for invalid configurations - Comparison with scikit-learn baseline Authors: - Simon Adorf (https://github.com/csadorf) Approvers: - Victor Lafargue (https://github.com/viclafargue) - Divye Gala (https://github.com/divyegala) - Jim Crist-Harif (https://github.com/jcrist) URL: rapidsai#7401
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements out-of-bag (OOB) scoring for
RandomForestClassifierandRandomForestRegressor, enabling users to estimate model performance without requiring a separate validation set.Closes #7395
Changes
C++ Layer
fit()functions to accept optionalbootstrap_masksparameter for storing per-tree bootstrap sample indicatorsRandomForest::fit()to capture and store bootstrap masks whenoob_score=TruePython Layer
oob_scoreparameter (boolean only) to Random Forest estimators_compute_oob_score()method that leverages FIL'spredict_per_tree()for efficient OOB predictionsoob_score_andoob_decision_function_(oroob_prediction_) attributesoob_scoreis boolean (custom scorer functions not supported)Metrics
Limitations
oob_score) are not supported - only boolean values acceptedTesting
Added comprehensive tests covering: