After the initial root split, the data in each child branch is still not pure — multiple classes or values coexist. The tree needs a mechanism to keep asking questions and refining its predictions without prematurely stopping or over-splitting.
An internal node (decision node) is any non-leaf node in a decision tree that represents an attribute test. Each internal node asks a question about a specific feature, and its branches represent the possible answers, directing the data flow to child nodes.
Internal nodes operate during both construction and prediction:
During construction:
- The subset of data reaching this node is analyzed
- Available attributes (excluding ancestors on this path) are evaluated
- The best attribute is chosen using Information Gain or Gini Index
- Branches are created for each possible value of the chosen attribute
During prediction:
- The incoming instance reaches the internal node
- The node evaluates its attribute test on the instance’s feature value
- Based on the answer, the instance is routed down the corresponding branch
- This continues until a leaf node is reached
In the source example, “Age > 30?” and “Previous Purchases > 0?” are internal nodes that refine predictions after the root node’s income check.
- Attribute test: Each internal node tests exactly one feature/attribute
- Branching factor: Number of outgoing branches equals the number of possible attribute values
- Subset-specific: Operates only on the data subset that reached this node, not the full dataset
- Recursive role: Internal nodes can have internal nodes as children, creating nested decision paths
- Built from: Decision Tree Splitting — internal nodes are created by splitting
- Builds into: Decision Tree Structure — internal nodes form the tree’s intermediate layers
- Builds into: Leaf Node — internal nodes eventually terminate at leaves
- Built from: Attribute Selection Measures — chooses which attribute to test
- Related: Root Node — root is a special case of an internal node (the first one)
- Builds into: Decision Tree Prediction — internal nodes guide the prediction path
- Feature reuse: In some implementations, the same feature can be tested at multiple internal nodes along different paths
- Exhausted attributes: If all features have been used on a path, remaining internal nodes must use majority vote
- Depth explosion: Internal nodes can proliferate, creating trees too deep to interpret
- Overfitting risk: Each internal node adds complexity; too many internal nodes memorize training data