20230227115732-C
A leaf can be split by comparing features and if they reduce the gini impurity of a branch. The feature generates the lowest gini impurity for that branch is chosen.
Example:
flowchart TD
A[Loves popcorn]
C[Does not love the song\nGini impurity: 0.3]
D[Loves the song\nGini impurity: 0.48]
A --> |True| C
A --> |False| D
Checking if splitting the right node via loves cats
would reduce the branch gini impurity:
flowchart TD
A[Loves popcorn]
C[Does not love the song\nGini impurity: 0.3]
D[Loves cats\nGini impurity originally: 0.48\nGini impurity of branch: 0.42]
E[Loves the song\nSamples: 50\nGini impurity: 0.4]
F[Does not love the song\nSamples: 10\nGini impurity: 0.5]
A --> |True| D
A --> |False| C
D --> |True| E
D --> |False| F
The node would be split into a branch as the gini impurity of the branch is lower.