Decision Trees, Random Forests & Gradient Boosting
Q: Bagging vs boosting? Why does XGBoost win on tabular data?
- Decision tree: greedy splits maximizing impurity reduction (Gini
1−Σp²or entropy−Σp log p; variance for regression). Interpretable, handles mixed types, but high variance. - Random forest (bagging): many deep trees on bootstrap samples + random feature subsets per split → averaging reduces variance. Robust, little tuning, out-of-bag error estimate.
- Gradient boosting (GBDT: XGBoost, LightGBM, CatBoost): add shallow trees sequentially, each fitting the negative gradient (residuals) of the loss → reduces bias. Needs care: learning rate (shrinkage), number of trees, depth, subsampling, early stopping.
bagging: data -> [tree][tree][tree] (parallel, independent) -> average
boosting: data -> tree1 -> residuals -> tree2 -> residuals -> tree3 ... -> sum (sequential)
GBDTs dominate tabular data: handle heterogeneous features, missing values, non-linear interactions, monotonic constraints, fast training; little preprocessing (no scaling needed).