Unit 4 Cheat Sheet: Decision Trees & Ensemble Learning
Course - Machine Learning Algorithms (21CSC555J)
Assessment - Continuous Test 2 (CT-2)
Scope - CART Classification Trees (Gini Index, Binary Splitting) and AdaBoost (Stumps, Weight Updates, Bias-Variance)
Primary Reference - Unit 4 Full Exam Solutions
1. Exam Overview & Fast Mapping (40 Marks)
| Question | Algorithm & Topic | Core Numerical Shortcut | Essential Theory Keywords |
|---|---|---|---|
| Q3 (20M) | CART Tree: Customer Buy Decision | Root Gini Age Group split vs wins (, ) | Binary splitting (), Cost-complexity pruning, Tie-breaking rules |
| Q4 (20M) | AdaBoost: Transaction Fraud Classification | error | Decision stumps (high bias/low variance), Sequential reweighting, Missing value bypassing |
2. Question 3: CART Classification Tree (20 Marks)
Step 1: Root Node Gini Calculation (4 Marks)
- Total (C3, C4, C5, C6), (C1, C2, C7)
- Formula:
Step 2: Binary Splits Speed Table (8 Marks)
CART requires testing all candidate binary partitions per attribute:
| Attribute | Candidate Binary Partition | Left Node () | Right Node () | Weighted Gini | Rank / Status |
|---|---|---|---|---|---|
| Age Group | vs | 0 Yes, 2 No (, Pure) | 4 Yes, 1 No () | WINNER (Best Split) | |
| Age Group | vs | 2 Yes, 0 No (, Pure) | 2 Yes, 3 No () | Suboptimal | |
| Age Group | vs | 2 Yes, 1 No () | 2 Yes, 2 No () | Suboptimal | |
| Income Level | vs | 2 Yes, 0 No (, Pure) | 2 Yes, 3 No () | Best for Income | |
| Income Level | vs | 1 Yes, 2 No () | 3 Yes, 1 No () | Suboptimal | |
| Income Level | vs | 1 Yes, 1 No () | 3 Yes, 2 No () | Suboptimal |
Step 3: Best Attribute Decision (4 Marks)
- Age Group Gain: (Maximum Gain)
- Income Level Gain:
- Decision: Choose Age Group with split condition vs . It yields lowest impurity and cleanly isolates an immediately pure leaf node ().
Step 4: Theory Scoring Points (4 Marks)
- Tie-Breaking Protocols (2 Marks):
- Acquisition cost: choose feature cheaper to collect in practice.
- Subtree balance: choose split creating more evenly sized child nodes.
- Schema order: default to first column in dataset table.
- Secondary metric: compute Information Gain (Entropy).
- Two Advantages of CART over ID3/C4.5 (2 Marks):
- Classification & Regression Support: Handles categorical (Gini) and continuous targets (MSE / variance reduction).
- Strict Binary Splitting: Avoids multi-way branch fragmentation, preserving sample size in deeper nodes.
- Disciplined Cost-Complexity Pruning: Minimal cost-complexity -pruning validated with cross-validation.
3. Question 4: AdaBoost Fraud Classifier (20 Marks)
Core Weight Update Formulas
- Initial weights:
- Weighted error:
- Stump importance:
- Sample update:
- Correct: (attenuated)
- Wrong: (boosted)
- Normalize by so weights sum to .
10% Misclassification Numerical Shortcut (Sub-part iii: 4 Marks)
- Error rate: (Holds when weights are uniform, as in round 1)
- Odds ratio:
- Importance weight: (Note: Textbooks omitting yield . Use standard Freund & Schapire form unless specified).
- Meaning: High positive voting weight in final ensemble rule .
Theory Scoring Points
- Why Decision Stumps? (4 Marks):
- Easily satisfies weak learner condition ().
- High bias, ultra-low variance: Starting with low-variance models prevents ensemble variance from exploding.
- Fast training: Only split evaluations.
- Interpretability: Aggregated stump weights directly yield feature importance scores.
- Bias vs Variance in Boosting (4 Marks):
- Reduces Bias: Each stump focuses on samples earlier stumps got wrong through higher sample weights (not residual fitting); linear combination builds non-linear boundaries.
- Increases Variance: Repeatedly misclassified noisy points keep gaining relative weight after normalization, forcing later stumps to overfit noise pockets.
- Handling Missing "Device ID" (4 Marks):
- AdaBoost has NO built-in missing value handling; it inherits base learner / pipeline behavior:
- Option A (Imputation): Impute via mode/median before training.
- Option B (Separate Category): Treat
Missingas a distinct level (Device_ID = Unknown), capturing deliberate fraud concealment. - Option C (Base Learner Handling): Use stumps that natively handle missing values (CART surrogate splits or C4.5 fractional weights).
4. Golden Numbers & Exam Traps
Quick Number Reference
- Q3 CART Tree: Root Gini , Age Best Gini (Gain ), Income Best Gini (Gain ).
- Q4 AdaBoost: . Correct factor , Wrong factor .
danger
Avoid These Common Traps
- Gini vs Entropy: Gini uses squared probabilities (). Do NOT use logarithms.
- Binary vs Multi-Way Splits: CART always tests binary partitions (). Don't just compute a single 3-way split.
- Weight Update Signs: Misclassified instances get (increased); correctly classified instances get (decreased).
- Log Base in : Use the natural logarithm (), not or .