While preparing decision tree for the titanic survival dataset, I tried to visualize the tree by creating logs indicating depth, feature, and whether it’s left or right node. I got the following data:
- Depth is 0, Feature is Sex, left: Nan, Right: Nan
- Depth is 1, Feature is Pclass, left: True, Right: False
- Depth is 2, Feature is Pclass, left: True, Right: False
- Depth is 3, Feature is Parch, left: True, Right: False
- Depth is 4, Feature is Age, left: True, Right: False
- Depth is 5, Feature is Age, left: True, Right: False
- Depth is 5, Feature is Age, left: False, Right: True
and so on …
Here, in 2 and 3, Pclass is appearing in same branch(left) and in 5 and 6, Age is also appearing in same branch(left).
Why?