Can we use the gini index to assign a class to a leaf node? If yes how? As far as I understand the gini index can only be used as a splitting metric.

  • $\begingroup$ You mean Gini index? $\endgroup$ – Carlos Mougan Apr 22 '20 at 21:35
  • $\begingroup$ Yes exactly @carlos $\endgroup$ – christopher Apr 22 '20 at 21:45

Short answer: No

Long answer:

What do you mean by 'assign a class to a leaf node'? The question itself is strange. Gini index is used as splitting criteria in the building process of decision tree and the classes in leaf nodes are the final result of a building process.

The building of a decision tree is an automatic process based on the principle of greedy maximization of some quality criteria/splitting rule (Gini uncertainty (Gini impurity/Gini index), information gain, Misclassification error): at each step, the algorithm chooses the variable that gives the greatest value upon splitting. Then the procedure is repeated recursively until the entropy is zero (or some small value to account for overfitting).

Maximizing the Gini uncertainty can be interpreted as the maximization of the number of pairs of objects of the same class that are in the same subtree.

I will leave an example of tree below.

enter image description here

Also, if you want, you can check out this wonderful notebook on the theme that gives a full understanding of decision trees and the theory behind them:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.