Halaal, so before going ahead in this session, let's have a quick recap of what we have done in our
previous session.
In the previous session, we have learned some basics of cross-validation, what exactly it means.
We just understand if we play with this randomness, quested barometer's, we we definitely have a fluctuation
in our accuracy.
That's why we have to cross validate our model using using this parameter, using this seewhy parameter.
And once we have this, then what we have to do, we have to simply compute Esmie.
That's it.
And it will it will give some accuracy.
And that is exactly why the accuracy.
So in this session, we have to learn some some of the I guess some of the cross-validation approaches
that are exactly my randomise thoughts.
TV ad grid search.
So what are exactly these?
And before understanding this, let's let's have some basic idea behind.
Yeah.
What is that hyper parameter optimization or I can see what is the model hypertonic.
So let's say whatever machine learning algorithm, whatever machine learning algorithm you have implemented
on your data or on your data frame, whatever you want to consider, whatever machine learning algorithm
that you have implemented on your data set, what our machine learning algorithm that you have implemented
on data, let's say let's say you have some regression.
You guess or or let's say you have some classification.
Let's say you have this Justis.
Let's say the algorithm that I have implemented on my data, let's say I have implemented random forest
on my data.
So once once I have implemented this random forest on my data so far, this we have a class in my Ascalon
module.
In case of regression, I have something known as random forest regression, random forest regressive,
whereas in case of classification, I have something known as random forest classifier.
So what do we have to do, what we have to do very first, so if we train, if we train our model,
if we train our regression model, or if we have a classified model, so it will definitely get trained
by using by using a different parameters, using default parameters of my random forest aggression.
Similarly, in case of default barometer's.
In case of Regnum Forest, this classifiable, but it is not compulsory, but it is not compulsory,
whatever you say you have that was sold using this default barometer's whatever Arimidex in case of
random forest left in case of random forest, classify it.
You have some barometer's exit number of businesses and trees, which is nothing but what are mine and
on the school altimeters as well as you have something known as maximum features which is my max on
the school features whose value let's say what auto is Gary Locke took manyas value that that's not
a huge number of vicinities you own.
And what are my what is the maximum depth of a tree?
What is the maximum that of the season tree that I'm going to consider it in my it in my random forest.
So these are my these are basically the parameters.
So what do we have to do?
So that's it is its default value, Lexa's default values.
One hundred.
And let's say it's it is just auto.
It is it is by default.
That is auto that it is somewhere let's say two or three what whatever default value set or whatever,
whatever value already in Sakhalin modu.
But it is not necessary, whatever you say you have with respect to that youth is these values are going
to fit.
So what we have to do in such case, so in such case, in such case, what we have to do to optimize
to optimize our this classifiers.
So to optimize what I can say to achieve the best disvalue, to achieve the best value of all these
parameters, of all these hyper parameters, to achieve the best value of this hyper barometer's.
You have something known is let me bring you which we have something known as this great research,
S.V., this research TV and you have something known as this randomise, such TV spot, exactly what
it was like.
Let's understand what exactly the difference between both how how that actually works.
So what do we do over here?
Let's say so here what we have to do, we have to define a dictionary over here and in this dictionary
what we have to do.
So what what what what use case?
Let me sit here.
You have a classic classification.
You get elected.
These are my custom parameters defined by your random forest.
Classify it inside you, Cyclone.
So what I am going to do over here, I'm going to define a dictionary.
And in this dictionary I would say, let's say number of number of decision trees.
You can consider, let's say one hundred, two hundred, three hundred.
Then let's say they'll the exit polls in 2000.
Similarly, you have some parameters, let's say Max features.
So here I'm going to say it is my let's say auto in auto mode in something known as Lotu as well.
And I have asked and there are lots of lots of values.
Similarly, I have Max that parameter.
And you can consider its value as well here in case of classification, you have all these parameters.
Similarly, what you have to do once you create this dictionary, you have to pass.
You have to pass this dictionary to your grade, such as CV, to your grade, to CV, and you have to
verify it here.
You have to pass what exactly the algorithm that you have to pass to this great CV.
So my algorithm is exactly my random forest classifier.
So here I have to pass the objective of that algorithm.
Then I have to pass this dictionary in exactly my badam underscore a good barometer.
So in this barometer we have to parse this dictionary and here we have to pass our cross-validation
what we have learned, what we have learned earlier.
And many of those better media than you can play with, but these barometer, but these three, the
first two and what is your would classify it?
The second one, you use this this dictionary, this dictionary and the second then the third one.
Exactly.
You'll see barometer.
And there are lots of antenna's good jobs and multiple multiple parameters that that's not issue.
So what do we have to do over here?
So it will seize this critical services.
Yeah, I will do permutation and combination with each and every parameter that you have defined.
Final word and which our player, whichever peer, whoever peer I can say whose Lavoipierre would give
me highest accuracy.
Let's say let's say let's say this one hundred.
And in case of an estimate, just in case of selected math features, I have something like to extend
or maximum that I have something like that for.
Let's say this beer gives me high tech reselected.
This gives me some 90 percent accuracy for what we will do.
We will consider this beer.
We will consider this beer and and and we are going to fit our model.
We are going to fit our model or we are going to initialize our algorithm.
We are going to initialize our algorithm with this model and then we are going to perform training with
this best model.
What I can see with the best parameter, with the optimal parameter that we have achieved over here,
that's what that's what this group says we will do.
It will exactly return me my best model.
I can see this is my best model and best parameters.
That's what that's what this good research team will do.
Best model and best parameters.
So once we have this best model and that parameter, it will definitely give us the best accuracy.
So that's the advantage of using this cross-validation, this this great CV and all these things.
Now, you would think so.
So we have Suja of you all are aware about this.
What is excessive?
So what exactly is this randomise?
You all guys are asking this.
So here in this grid is such CV, in this grid is such TV.
What happens?
We have to do permutation combinations with these parameters, with these parameters.
But in this randomizer CV, I'm going to see just pick up some random parameters, just pick up some
random parameter.
Let's say I'm going to pick some three hundred XY here from Lotu.
And here I'd like to do and I would say just check accuracy.
And if whatever accuracy you have is stored in some data structures, let's say you are going to store
some let's you are going to store all the accuracy in some let's list and what accuracy you have to
store over here just to return me my best accuracy.
That's what that's what this randomizer CV will do.
So if you guys are thinking which one of these which would be better, definitely if I if I will talk
in terms of computation, power competition.
So that definitely that is Pioneros because you will see it.
I am going to pick a random parameter.
I don't have to do this, this permutation combination because what if what if I have let's say I have
ten parameters and let's say let's say I'm going to set this this this is data.
Let's say this is data that I have stored over here in list, which is exactly my value with respect
to this key.
Let's say let's say I have had twenty values.
So you will see you will see how complex it is if I am going to do this Baluchestan and combinations
over here.
So what I can do to get rid of this, this, this, this issue, what I can do, I could pick up some
random parameters and then I would say just determine the best accuracy so that really both of the approaches
are good but are random, such as I can see it is better than this.
Good to see in terms of computation power.
And definitely it is great to see what takes a lot of time at the time of execution.
And whereas with respect to I thought it takes less time with respect to this this grid search.
Similarly, with respect to other other algorithm you have, you have multiple parameters.
Activate this back to, if I will, talk about with respect to logistic regression, with respect to
logistic regression, we have something known as the parameter.
We have something known as the relative or we have something known as Benetti parameter that I'm going
to say what type of regularization technique I'm going to use.
And so there are lots of parameters in each and every machine learning algorithm.
Similarly, we have SVM.
Let's see what type of kernel we are going to use in the case of this disease entries, what type of
approach, what type of approach you are going to build decision trees, whether you are going to use
a concept of entropy, whether you are going to use a concept of your your information or whether or
whether you are going to use the concept of yogini impurity.
Similarly, similarly.
No, no, this is entry's similarly what is up what is a maximum depth of decision.
So these are these are all your parameter.
These are all your high.
Parameters that you can play with that and once you will get your best bills, once you will get your
best bills, just clean this model with the best, just train the model, just train it, just train
it.
And once you train this model, it means you have a best model and you have this best, because once
you have all these things at a best, you will definitely get your best accuracy.
Literally in each of the algorithm, whether it's a classification, whether it's a linear regression
in each of the average KADHEM, that's all about the session.
Hopefully you will love this session very much.
Thank you.
Have a nice day.
Keep learning.
Keep growing.
Keep practicing.