Decision Trees (Entropy vs Gini), Random Forests & Gradient Boosting (XGBoost)
Shannon Entropy, Information Gain, Gain Ratio (C4.5), CART Gini Impurity, Bagging out-of-bag variance formula, AdaBoost sample reweighting, and XGBoost second-order Newton boosting.
1. Impurity Criteria: ID3 vs C4.5 vs CART
| Tree Algorithm | Splitting Metric | Multiway vs Binary | Handles High-Cardinality IDs? |
|---|---|---|---|
| ID3 | Information Gain | Multiway | β Biased toward attributes like Roll_No |
| C4.5 | Gain Ratio | Multiway / Binary | β Penalizes large intrinsic split entropy |
| CART | Gini Impurity (or MSE for Regression) | Strictly Binary | Uses Cost-Complexity Pruning $R_\alpha(T) = R(T) + \alpha |
Rapid Binary Node Calculation ():
- Entropy bit (maximum for 2 classes; for classes).
- Gini Impurity (maximum for 2 classes; for classes).
2. Bagging & Random Forests vs Boosting (AdaBoost & Gradient Boosting)
Bootstrap Aggregating (Bagging): Draws bootstrap samples of size with replacement. Probability a specific instance is never selected in draws (Out-of-Bag / OOB):
Thus each bootstrap sample contains unique training rows!
- Random Forest: Combines Bagging + Random Feature Subspace ( for classification, for regression at every split) to decorrelate trees (lowering in ).
- Gradient Boosting: Fits tree sequentially to the negative gradient (pseudo-residuals) . XGBoost uses second-order Taylor expansion with gradient and Hessian : optimal leaf weight .
Bagging vs Boosting Exam Classic: Deep unpruned trees have low bias, high variance Bagging / Random Forest reduces Variance (cannot overfit solely by increasing ). Shallow decision stumps have high bias, low variance Boosting sequentially reduces Bias (can overfit noisy labels if is too large!).
Practice Questions on This Chapter (2)
A Decision Tree node contains positive and negative examples. Splitting on binary attribute produces left child () and right child (). What is the Gini Impurity reduction () achieved by attribute ?
In an AdaBoost iteration, a weak classifier achieves weighted classification error . What classifier weight is assigned to ?