Hello, all in the previous session, we have learned what is entropy information gain, and then we
will end up having our beautiful country.
So in this session, we are going to learn how exactly you get built.
This country using something known as something known as this Guiney index, something known as this
Gimmee Index Alexiev.
This is exactly why you this letter.
This is my youth case, of which we have to believe that this is Entry-Exit on the basis of class and
on a basis of some genden, I have to predict whether that particular person is going to stay in hotels
or not.
This is my case for how to build a decision of this, not of caution, is the major concern in this
century.
I can see the major concern.
This is the tree which which feature gets selected as a pattern or because once we have ignored our
our our following statement almost gets old.
So there is a one on one approach that we have already did with that, which is exactly using a concept
of entropy and information in that we all have learned in all of the recession.
We have one approach.
We can very easily, easily find this decision tree with feature get selected as paranoid and subsequent
note and all these things, we can easily find it.
So now we have to understand how you can solve a similar problem statement using Chiney building, because
calculation wise, this body is less complex than this, this one.
And definitely that there are lots of algorithms that uses this Jenene that internally I that you need
both internally to witnesses and treat.
There are lots of algorithms.
So how how to how exactly do we have to understand?
It's all you have to understand.
It's intuition.
Let's say this this is our use case and we have to build a decision to let me open a new page.
Very first time we will let's say let's the very first we have to start at the very first.
We have to start with a class.
Let's say we have to start with this class because then we have to compute the index of each and every
feature.
So let's say let's start with how to compute Gini index.
You need that Virginny of this class feature Hitzig.
So let me let me construct a table over here.
Let's I have some lexia, my features next class.
And here I have that second let's say I have my target variable, whether it is going to stay or not.
So you will see in your class feature, in this class feature, you have basically eight, nine, 10,
11.
And with respect to this, you have some counts.
So let me write down all these things.
Let me say with respect to class, I have eight, nine, 10, 11 similar.
We have some code as well.
So this was back to class eight.
I have gone somewhere.
I have count as yeah, I have two years and no ones and here I have two years and count or no is definitely
one.
Similarly, over here I have one year and count of no is definitely three.
Here I have count those years is three and my this one is one.
So this is, this is, this is with respect to this is with respect to this class feature.
This is all things with respect to class feature that you could simply obtain from this dataset.
There's nothing left notation.
Now you will see here you have total.
Let me let me write down let's say here you have let's say I have a feature as it's a feature.
So here you have this three, two plus one here.
Similarly three here you have four.
Here you have four.
So so what is the probability what is the probability of of Class eight, again, same of class eight
of class you'd like to gloss.
It is two lengths of class.
It is students that are going to stay in hotel.
So we have to compute it in one in one column and then we have to compute what the probability of class
it is to get that is not going to stay or we have to also compute.
So basically, it's probably proactively to, I think, because here you have to count this to two.
It means we students are going to stay a total of three, sit with this to it.
So it will be won by three.
Similarly, over here, you have something known as to right here, here, here you have one by four.
Here you have something, three by four.
Here you have something one right here you have something three by four.
And here again, you have something.
I can see one.
So let's compute, Bill, before for this feature length computing.
So what is and what is it?
What is the genie beauty when you're when you're glass?
Is it for us?
What does it mean?
It is nothing but one minus, what is the probability that it is available?
I can see the probability of yes.
That that that that each and every class available orbit Holdsclaw plus this probability of No.
So if you will do some basic calculation, whether it is nothing but two squared plus one of my things,
it will definitely give you four by four, because this is a four by nine is one of my nine.
And if you have to do all these things, it will exactly me.
Similarly, with respect to Glass nine.
Similarly, the respect to Class Nine, you have some value.
So it is nothing but one Marantis, which virtually exactly give you four minutes.
Similarly, with respect to R, then with respect to 10, you have some values which is nothing but
one minus this one by four plus three by four, which is nothing but 16.
So it will become six by 16.
And similarly, with respect to 11, here you have class 11.
So in this case, here you have nothing but this again.
Again, you have six by 60 that does not affect you.
So now what do we have to do now?
We have to compute Guiney for in class.
So how you have to compute.
So basically we do some of Jini build.
This whole class feature will be nothing.
But let me let me open a new widget to compute.
We get them to compute weightism.
Let's say this is my genius and that class, that this is a genius class.
So how to compute it?
So it's a basic basic for a very basic it is like a cake piece.
Let me let me write down.
It is nothing but number of instances, number of instances in Class eight.
I don't properly in classic.
It's divided by total instances.
Total instances in two GenY of.
Class IG.
Of glass it plus I have to do four glass minus one plus I have to do four plus 10 plus I have to do
for Class 11 as we select them here, I would say.
And also plus nine.
And let me let me let me do it as m so this is something like M m into G.
Both.
Class 10, I think, but last night, yeah, civil over here, I have some some some something like
that similar head for class cleverness with respect to class level.
So let me let me just put some values.
So for classic, what we have computed in our previous this one, which is nothing but mine for classic,
which is nothing.
But you will also hear both instances where it is available is exactly three words.
Total instances, total instances of class is exactly 14.
So it means it is nothing but May 14.
So it is nothing.
But here I have to write as three, May four.
And what is that what what you have computed with respect to the classic four by name in a previous
slide similar here I have something for class nine, three by 14.
Similarly over here I have four by nine.
And similarly over here we have computed with respect to Class Ten, we have I think four.
Yeah, four by four.
So there's is nothing but just four by 14 and Geneve will be exactly six by 16 that we have already
computed.
So here definitely we have four by 14 and it is nothing but six by 16.
And if you will do some basic calculations here, it is almost almost like an almost zero point four
zero four.
It is almost equal to zero by fours in a similar way, in a similar way.
You have to do all these operations for your gender as well.
So once you have let's say let's say you have to compute for X, you have to compute for genders how
to compute, how to complete.
What do you have to do?
You have to just create a table very first just to create a table.
Just calculate using that formula that I have given.
What what was that one minus probability of just a squared plus probability of simple.
Simple it.
Once you will get this, then you have to compute guiney all this entire gender simple as simple as
having some piece of cake like formula.
So once you have this formula, you will get Eugène Guiney for this and Baginda.
So once you will calculate it, its value will be somewhere around somewhere zero point for it and zero
point for it to fly.
You will see here you je ne of je ne of this class je ne of your class je ne of your class is less than
this due of class is less than g of gender.
That's what that's what you have.
That's what you have calculated it with this, it means glass has launched, impurity will definitely
selected as your rotenone.
So let me let me open a new open or no.
Yeah.
So your glass will be.
Get selected as your group and on the basis of this and on the basis of you have all the different different
classes eight, nine, 10 and here you have 11.
So you have some kind of a split.
You have some kind of split here.
You have something here.
You have something.
You have to just fill this blocks.
You have to just fill in this blocks.
According to your data, according to your data, once you have, then you have to solve this.
Then you have to solve this, that, this.
And at the end you will end up having your decision tree like this.
Like this, so you will end up having like this decision, Chris?
That's what I'm trying to show.
That's another approach, if I will talk about with respect to how to help build up happiness.
So let's talk about what is your post bruening?
What are your pruning?
That that that definitely helps if you have something like overfitting condition in your disease.
So what is what is this post pruning and let's say what are your tree pruning?
What is very first, let's understand what is most pruning.
So definitely this this post pruning and this tree pruning board is extensively used whenever, whenever,
whenever you have to cut, whenever you have to get rid of, you're always putting issues whenever you
have some or fitting issues in your in your in your decision tree, then you have to use something known
as most pruning and pruning.
So what, what, what exactly do what exactly do.
So they will basically control the depth of a tree.
We will see.
We we have to like this.
We will we will seem to like this.
So what they will do, they will control the depth of a tree.
They will control.
They will control it.
So let's talk about very forced this both pruning approach to this post pruning approach.
So so in this process, what happens?
What happens over here?
So basically in this post pruning my decision tree is is is generated, forced, very forced.
My decision to question it.
And after it, what will happen after this?
This post pruning is both pruning, remove some will the less branches, I guess, see some useless
branches from this decision tree by by using what I can see by experimenting some cross-validation approaches
like Liko Randy, my thoughts seem like random.
I thought silly, like good results for basically using using this this cross-validation approach,
which is nothing my my experimental approach.
It removes the useless Brontë's useless branches of this.
This is a tree.
So what they will do, what they will do.
So they will basically control the height of what tree or against that of a tree.
And we will not end up creating the infinitely growing this diffidently.
It will control basically its depth, it will control its depth.
So what exactly?
Let me summarize it.
What, what, what, what this post born into, let's say in very first step, we will build our decision
tree in the second step.
In the second step, what we will do, we will check accuracy for training data.
Let's say I have accuracy as ninety five percent for training.
But with respect to my bastida, you have accuracy like this.
Sixty percent.
Now you will see you have some kind of overfitting issue for you.
Whenever you have some auditing issues, consider your pruning approaches to what they will do.
They will remove some useless branches.
They will remove some useless branches using our experimental approach like like cross-validation,
like things like randomizer, CV, CV, some some opportune algorithms like some of algorithms as well
for using these these, these techniques.
We can remove some useless branches of this, of this decision tree and and at the end we will improve
our accuracy, we will improve the accuracy of the of this.
This is simply the fourth test for this pruning approach will do.
So what so what this pre pruning will do.
Let me open a new page to what or what this pre pruning will do.
What this pruning.
Will do so it is it is also known as forward tuning, basically, it is also known as forward tuning,
whereas whereas this post borning known as basically My Backward Pony.
So what what they exactly say it is, it also controls the height of our season.
It also controls height of the season.
But there are some minor differences.
So in post pwning, what we will do, we will we will very first build our decision tree.
Then we will remove some useless branches.
But in pre pwning, what we will do, what we will do, we will sit before building the season tree,
before building this decision tree, let's say before building some kind of decision tree we will basically
control.
Is that whereas using.
Using some seewhy techniques, which is my cross-validation techniques like Liko, Randomizer, TV like
or grid search like grid such Siri, we will find our best parameters, we will find our best barometers.
And then and then we will we will find our best model.
Because once we have best parameters, then we will definitely get our best model so long as we have
best model.
Once we have our best decision tree, once we have best decision tree, then what we will do, we will
perform training.
We will go from training, then we will do testing on our test data.
That's what that's what this people do.
So before building this is complete, it will do all these steps.
It will do all these steps before we see the dream.
But putting postponing what will happen once it will be decision that we are going to apply all these
techniques.
There's a minor difference between this pre and post.
So I hope you understand all this kind of thing.
So thank you, guys.
How nice to keep learning.
Keep growing, keep practicing.