Gini impurity (source code)

= Gini impurity
{c}

For class proportions $p_1,\ldots,p_K$ in a tree node, Gini impurity is $1-\sum_kp_k^2$. For two classes it is twice $p(1-p)$; omitting the constant factor does not change the selected split.