# Decision Tree, Gini Index

#1

Hello,

With reference to the following article:

There is an example under the head What is a Decision Tree ? How does it work ? which states that there are 30 students with three variables Gender (Boy/ Girl), Class( IX/ X) and Height (5 to 6 ft). 15 out of these 30 play cricket in leisure time. Estimate who will play cricket?

in the first step while splitting on gender we have worked out that out of 30 students there are 10 females ( 2 play cricket )and 20 males(13 play cricket. Can someone tell me how has this math been worked out

snapshot attached

Thanks!

#2

Hi @mohitlearns,

We have our training data and we are trying to understand how a decision tree would work. For each split, we try to create two nodes such that each node has points of the similar category.

With our example, we want to make a split such that maximum of people playing cricket are at one side while maximum non-players on the other side. When we split on ‘Gender’, we are able to achieve that (better than when we split on the class or height of individual)

I hope I was able to answer the question. Feel free to post any other query that you might have regarding this.

#3

if we were to look at Gender split my specific questions would be

How did we arrive at the following numbers
Females = 10 , Females who play cricket = 2
Males =20 , Males who play cricket = 13

in the problem statement all we are given is that there are 30 student and 15 of them play cricket.
Regards,

Mohit

#4

Hi @mohitlearns, it’s probably the language of the post that’s a bit confusing. If you have seen the traditional training dataset, we would have a set of rows (30) and some columns/features (gender/age/class/height) and a target variable(plays cricket or not).

``````ID  Gender  classes  height  target(plays cricket)
1    male        X          5.4         Y
2    female      IX         5.2         Y
3    male        IX         5.0         N
.
.
.
30   male        X          5.4        Y``````

#5

@AishwaryaSingh Thanks a ton ! That explains it and clears the confusion

#6

Great!