- Year not given · 6+3 marks
ID3 algorithm and WEKA confusion matrix
Short answer
ID3 builds a tree top-down by selecting the highest information gain attribute, branching for each value, and recursing until all examples have one class, no attributes remain, or a branch is empty. The WEKA confusion matrix compares actual versus predicted classes; the diagonal shows correct counts, off-diagonal cells show errors, and it supports accuracy, TP rate, FP rate, precision, recall and F-measure.
Write the ID3 algorithm. Explain the significance of the confusion matrix generated by WEKA.
ID3 algorithm
ID3 builds a decision tree top-down. At every node it picks the attribute with the highest information gain, where Gain(S, A) = Entropy(S) − Σ (|Sᵥ|/|S|)·Entropy(Sᵥ) and Entropy(S) = −Σ pᵢ log₂ pᵢ.
ID3(S, Attributes, Class)
1. Create a node N.
2. If all examples in S have the same class C
return N as a leaf labelled C.
3. If Attributes is empty
return N as a leaf labelled with the majority class of S.
4. For every attribute A compute Gain(S, A).
5. Choose A* with the highest information gain; label N with A*.
6. For each value v of A*:
Sv = examples of S with A* = v
if Sv is empty: add a leaf with the majority class of S
else: add the subtree ID3(Sv, Attributes - {A*}, Class)
7. Return N.
Significance of the confusion matrix generated by WEKA
The confusion matrix tabulates the actual class of the test records (rows) against the class predicted by the model (columns). For two classes:
| Predicted yes | Predicted no | |
|---|---|---|
| Actual yes | TP | FN |
| Actual no | FP | TN |
It shows not only how many records were classified correctly (the diagonal) but also which kind of mistakes are made, and so it is the basis for the performance measures:
- Accuracy = (TP + TN)/total; error rate = 1 − accuracy.
- TP rate (recall, sensitivity) = TP/(TP + FN); FP rate = FP/(FP + TN).
- Precision = TP/(TP + FP); F-measure = 2·P·R/(P + R).
It is useful for imbalanced classes (accuracy alone can mislead), for comparing classifiers, and for judging whether a particular type of error (e.g. missing a patient) is acceptable. Off-diagonal cells show which classes are confused with each other.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- ID3 and TP rate, FP rate, precision · Data Mining, chapter 3
- ID3 steps, overfitting, TP/FP/recall · Data Mining, chapter 3
- Confusion matrix and performance measures · Data Mining, chapter 3
- Measures from confusion matrix (152, 130) · Data Mining, chapter 3
- Measures from cancer confusion matrix · Data Mining, chapter 3
- ID3 algorithm and why greedy · Data Mining, chapter 3
- Significance of arrays; multiply 3×3 matrices · Computer Programming, chapter 7
- Stiffness matrix: frame, BMD · Theory of Structures II, chapter 3
- Significance of circular linked list · Data Structure and Algorithm, chapter 4
- Big-Oh significance and limitation · Data Structure and Algorithm, chapter 9