In this session, we will understand how to create a decision tree.
Decision three forms the basis for random for the next most two most widely used algorithms in the world
today.
So let's start this with an example.
In this example, I am trying to predict the likelihood of an individual getting a heart disease and
I am considering three factors for that blood pressure, sugar and cholesterol.
So heart disease, the likelihood of someone getting a heart disease.
It's my dependent variable, and these three are independent variables.
OK?
Now, a decision tree is constructed like this.
We start with Amy, one of the three factors, and then go on constructing a tree like this high sugar.
Is it true or false?
If it is true means that the individual IBP.
Yes.
The individual at BP, did he also have high cholesterol, so on and so forth.
The challenge in Decision Tree is determining.
Where to start from, that is, which factors should I start the decision tree from?
That is known as root, not root, nor is the starting point in a decision tree data mining route known
as the.
First steps in constructing the decision, because you can start with a sugar high or high cholesterol,
right?
So I must know where to start from.
That is done using two is one is Guinea index and the other is known as Entropia information.
OK.
Now let's see how to compute the group not using Guiney index, so I have populated some values based
on historical data.
Someone I am considering, if you see, I am considering each of the three factors in isolation now.
OK, so I will consider the factors in isolation for the purpose of determining which node to start
from.
Right so high BP when I BP was through the likelihood of someone developing heart disease out of so
many people who had I be one of five people, developed heart disease and 39 did not develop our disease.
Out of so many people not having I be 34 people developed heart disease and 125 people did not develop
heart disease.
Same is the case with high sugar and high cholesterol, so many people had high cholesterol that refused
to prove right out of their mind.
Two people develop heart disease and 31 did not develop heart disease.
And some people did not have high cholesterol.
That is why you have Olsher out of them fortified developed heart disease and 129 did not develop heart
disease.
Right.
So this representation is what you do first, right?
And then you compute Guiney index using the Formula One minus probability of Estherville square one
minus minus probability of false score.
OK, so I, I'm explaining this for BP, right.
I now find the son will not find us.
Thirty nine total is one forty four and similarly total is 159.
OK, so I will compute Guinea for two.
Guinea for false.
Right.
So how will I do four to one minus one, not five, divided by thirty nine, plus one on five.
That is one four for the whole square minus no scenario.
I get a value of point three nine five.
And then for this I get a value off point three three six fast I consider it.
Yes.
Thirty four divided by one fifty nine which is thirty four plus one twenty five then I consider no which
is one twenty five thirty four plus one twenty five.
Is that in the denominator.
And then I square it right.
I got getting for true and false.
Now let's find the total need for BP.
That is one forty four for the two and one fifty nine for the Fox.
Right.
I multiply.
This value with the three nine five one three three six that I want.
If I then have total meaning for BP.
Is this clear?
OK.
I will use the same approach to compute Guinea for sugar and cholesterol, also frosti compute Guinea
for to Guinea for false and then I compute totally.
Right.
So I have taught in Guinea for BP sugar and cholesterol.
OK, in the case of BP, this point, three six four sugar is point three six point three eight one.
So that will start the decision from I will start where the guinea is the lowest.
OK, Guinea is lowest in the case of sugar.
So my will start with sugar.
The next will be the next highest one.
Right.
That is BP and then cholesterol.
Where are you getting it.
So this is how you construct the decision tree.
If you are wondering, do you need to do so many computations, so many calculations for creating a
decision tree algorithm?
Don't worry, there are pre-built libraries available in Python that makes all these computations very
easy.
OK, you just need to identify the dependent and independent variables.
The process of developing the tree, fitting the model is done by the library that makes the job so
much easier.
Right?
OK, we used to Guinea for the purpose of identifying the root.
We can also use entropy.
OK, mostly the root node will be the same both in Guinea as well as an entropy.
In few cases they will differ.
Right, the route will differ between Guinea and entropy in a few cases.
OK.