3.3. Classifying With a Classification Tree#
Consider the following test data:
Weight (kg) |
Tail Length (cm) |
Ear Length (cm) |
Class |
|---|---|---|---|
4 |
25 |
4 |
cat |
3 |
3 |
7 |
rabbit |
3.5 |
7 |
3 |
cat |
27 |
22 |
7 |
dog |
Let’s use our classification tree to predict the class of each animal.
Weight (kg) |
Tail Length (cm) |
Ear Length (cm) |
Actual Class |
Predicted Class |
|---|---|---|---|---|
4 |
25 |
4 |
cat |
cat |
3 |
3 |
7 |
rabbit |
rabbit |
3.5 |
7 |
3 |
cat |
rabbit |
27 |
22 |
7 |
dog |
dog |
We can see that our model correctly predicts 3 of the 4 test samples. This means the model accuracy is 75%