Solve Gini index for
Case (1): 4Y / 8N
Step 1: Given
- Y = 4
- N = 8
- Total = 12
Step 2: Probabilities

Step 3: Apply Formula

✅ Result
Gini Index (4Y/8N)=0.44
Gini Index for(Case 2) 8Y / 2N
Given:
- Yes (Y) = 8
- No (N) = 2
- Total = 10
Step 1: Write the Gini Index Formula

Step 2: Calculate Probabilities

Step 3: Substitute Values

Step 4: Final Answer
Gini Index=32/100=0.32
Final Result
| Case | Y | N | Gini Index | Node Type |
| 8Y / 2N | 8 | 2 | 0.32 | Impure (but less impure) |
Important Concept (Exam Point)
- Gini = 0 → Pure node
- Gini = 0.5 → Maximum impurity (binary class)
- Lower Gini value means purer node
👉 Since 0.32 < 0.44 (root) and < 0.5,
8Y / 2N is purer than 4Y / 8N or 3Y / 3N.
🔹 Comparison Table
| Case | Y | N | Gini Index | Purity |
| 4Y / 8N | 4 | 8 | 0.44 | More impure |
| 8Y / 2N | 8 | 2 | 0.32 | More pure |
Final Conclusion
Lower Gini Index ⇒ Purer Node
- Higher Gini Index ⇒ More Impure Node
Since 0.32 < 0.44,
8Y / 2N is purer than 4Y / 8N
CART algorithm will prefer the split with Gini = 0.32.
