Gini impurity measures how mixed the classes are within a decision-tree node. It is calculated as 1 minus the sum of squared class probabilities. A score of 0 means every transaction belongs to one class; higher scores indicate greater heterogeneity. section 3.4.4 section 3.9
Use the score to read tree nodes and understand their decisions:
- A node containing equal numbers of genuine and fraudulent transactions has a Gini score of 0.5. section 3.4.4
- Decision-tree splits aim to reduce Gini impurity, producing nodes with more concentrated class labels. section 3.4.4
Fraud-node calculation
For a node containing nine genuine transactions and one fraudulent transaction, calculate impurity from the two class probabilities using the binary Gini formula. The same approach extends to samples distributed across N classes.








