# Is GINI limited to binary classifiers or can we use it for multi-class classifiers as well?

I have looked around and have seen GINI being used mostly in the context of binary classifiers. Does GINI make sense only for binary classifiers? Can we extend the definition to multiclass classifiers?

## 1 Answer

The Gini impurity can definitely be used to quantify variance in a multi-class setting, not only in the binary case. Gini impurity is defined as

$$G(p) = \sum_{i=1}^{J}{p_i} \sum_{k \neq i}^{J}{p_k} = 1-\sum_{i=1}^{J}{(p_i)^{2}}$$

for the scenario with $J$ classes, each having probability $p_i...p_J$, where $|J|$ can be $>2$.

More information can also be found here: https://en.wikipedia.org/wiki/Decision_tree_learning#Gini_impurity

Possibly you had a difficult time finding help due to the ambiguity with the "Gini Coefficient" used in economics (https://en.wikipedia.org/wiki/Gini_coefficient).