Back to the 2022 paper

Module 3: Classification and Prediction

20227m

Describe the ID3 algorithm for decision tree construction. Why is it unsuitable for decision tree construction?

Worked SolutionAI Assisted

ID3 Algorithm for Decision Tree Construction — Description & Limitations

Overview

ID3 (Iterative Dichotomiser 3), by J. Ross Quinlan, builds a decision tree top-down, greedily, choosing the attribute with the highest Information Gain (based on entropy) at each node.

Entropy — the impurity of a data set DD with mm classes is

H(D)=−∑i=1mpilog⁡2piH(D) = -\sum_{i=1}^{m} p_i \log_2 p_i

where pip_i is the fraction of tuples in DD belonging to class CiC_i.

Information Gain of partitioning DD on attribute AA with distinct values {a1,…,av}\{a_1, \dots, a_v\}:

Gain(A)=H(D)−∑j=1v∣Dj∣∣D∣ H(Dj)\text{Gain}(A) = H(D) - \sum_{j=1}^{v} \frac{|D_j|}{|D|}\, H(D_j)

where DjD_j is the subset of DD with A=ajA = a_j.

Algorithm Steps

Algorithm ID3(D: training set, Attributes)
1. Create a root node for D.
2. If all tuples in D belong to the same class C → label node C and return.
3. If Attributes is empty → label node with majority class and return.
4. Else pick A_best = the attribute with maximum Gain(A).
5. Label node with A_best; for each distinct value a_j of A_best create one branch.
6. For each branch: D_j = {tuples with A_best = a_j}
   - if D_j empty → leaf labelled with majority class of D
   - else recursively run ID3(D_j, Attributes − {A_best})
7. Return the resulting tree.

Why ID3 is unsuitable — main limitations

  1. Handles only categorical attributes — continuous/numeric data must be discretized first; it cannot branch on < / <= thresholds.
  2. Bias toward multi-valued attributes — information gain favours an attribute with many distinct values (e.g. a "customer-ID" attribute would give maximal gain yet be useless), producing poor generalisation. This is fixed in C4.5 by using the gain ratio.
  3. No pruning → overfitting — it grows the tree until it fits the training data perfectly, thereby memorising noise and hurting accuracy on unseen test data.
  4. Greedy, no backtracking — a locally optimal split may lead to a globally sub-optimal tree.
  5. Handles missing values / noise poorly and is unstable — small changes in the training data produce quite different trees.

Despite these limitations, ID3 is the foundation for C4.5 / C5.0 (adding gain ratio, continuous attributes, and pruning) and further scalable classifiers such as CART, SLIQ, SPRINT, and RainForest.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.