Gini impurity measure

Gini impurity is a measure used for generating classification trees. It provides more information on the distribution of data per node than the classification accuracy used for reporting the tree accuracy.

Impurity of a classification tree node is computed using the count of each target category across all records corresponding to the given node. Gini impurity total is computed as a sum of squares of count proportions across all target categories per node subtracted from one, and the result is multiplied by the number of records.

For example, when splitting a tree node, the algorithm searches for a field with the largest improvement in total impurity computed as total impurity across all potential children nodes subtracted from the parent node total impurity.