# What exactly is a Gini Index

I am going through the tutorial at this site. Here, I can see the author is explaining the derivation of Gini Index. I want to understand the following terms

• Group
• Classes : As far as I have understood, it represents the possible values of labels in the data which we are supposed to classify. Please correct me if I am wrong.

The website here states that it is the difference between 1 and the probabilities of the classified values within the dataset while creating the split. But the first link does add some more points to the simple derivation. Can anyone please explain in layman terms the derivation of Gini Index?

A class is simply a label you use to categorize a bunch of objects. For example, if you were trying to create an email filter, you might have a spam class and non-spam class.
Suppose you have a data set that lists several attributes for a bunch of animals and you're trying to predict if each animal is a mammal or not. You would have two classes, mammal, and not-mammal. You start making your decision tree by asking if an animal is warm blooded or not and split your data set into two groups based on this splitting criteria. If an animal is cold blooded, it belongs to the not-mammal class, however, if an animal is warm-blooded, it may or may not belong to the mammal class. This new node (e.g., decision) might contain a mix, or group, of animals that may or may not be mammals (i.e., the group could contain birds and mammals). A 50/50 split between mammals and non-mammals at this node would mean the node is impure (with a Gini index of 0.5). A completely pure node would have a Gini index of 0 and would indicate a node is made up of only 1 class.