You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Out-of-Bag (OOB) Score Support to RandomForest (rapidsai#7401)
## Summary
Implements out-of-bag (OOB) scoring for `RandomForestClassifier` and `RandomForestRegressor`, enabling users to estimate model performance without requiring a separate validation set.
Closesrapidsai#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
0 commit comments