What is the out-of-bag (OOB) score in Random Forests?
mediumAnswer
- Each bootstrap sample leaves out ~37% of the training data (untouched by that tree).
- For each training point x, aggregate predictions from the trees where x was NOT in-bag; compare to y.
- This gives an internal estimate of generalization error at zero extra cost, roughly equivalent to a k-fold CV score, and lets you tune without a separate held-out set.
- Enable with in scikit-learn's RandomForestClassifier/Regressor.
Check yourself — multiple choice
- An error estimated on the training set
- Error on samples not seen by each tree — a free ~CV-quality estimate
- Error only on the held-out test set
- An error only for regression trees
OOB uses the ~37% left out of each bootstrap ⇒ nearly-free CV estimate.
#random-forest#bagging#evaluation
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- How does bagging reduce variance?
- Why does Random Forest sample features at each split, not just once per tree?
- How do Extra Trees differ from Random Forests?
- What is the bias-variance tradeoff?
- How do you detect and fix overfitting?
- What is k-fold cross-validation and when do you use stratified or grouped folds?