In this lecture, we will learn how to train our SVM model with radial kernel.
Again, these steps are the same as linear and polynomial kernel.
We just serve to mention Cardinal Liquidy to order B.F. and then we need to provide additional parameters
of Gamma, since you know that Gamma is the impact of nearby points.
Therefore, we need to provide value of Guama along with see.
And again, if you want some more details, you can always look at the scale as we see documentation.
So, again, first we are creating odor objects.
Then we are fighting over Ekstrand invite trend data.
Then we are predicting our Avivah Lewis for tests and rain.
And at last, we are finding that curacy scored two compared with what, watt lendee man model?
Let's run this.
Here we are using GOMI.
Well, 2.5 and seek well 10.
This is just our initial values.
Usually we choose the gumline, see where loose after applying research for our model.
Oh, let's run this.
We have created this object and we have free trade extending by train data.
Now we can use this object to predict y values of tests and train certain.
So let's do that.
To find the accuracy score, we have to first mention the actual values and then the predicted values.
So on our test data, the predatory score is point sixty one.
Now, let's do a grid search to find the optimize value of C and Gamma.
Here, I want to test these many values of see.
I am testing zero point zero one zero point zero five point one point five one five, 10 and 50.
You can expand this range also by adding some more values.
Next, Gamma.
I want to test this five values of gamma, which is zero point zero zero one zero point zero one zero
point one zero point five and one.
Since I want to test this, many will lose.
I have kept this values in the form of dictionary.
The key of this dictionary is the high but barometer's of my as we are mortal, which is God mine.
See, that's why I didn't see Ingomar as a keys.
And the values I want to test are done in the form of double in this dictionary.
We have parameter names as ski's and we have all the parameter values as a value of this dictionary.
Then we need to create the model on which we want to apply the search.
So since.
For us, the cut in the lives, Lizotte, if we if we will just use.
SVM daughter, as we see, and then got liquid do ought to be.
Ah, we have a sense what radial cardinal.
Then we need to create a grid search object.
The function we are using is grid search S.V..
The first parameter in grid search CV is you model.
Since our model is are not as as we are, we're not scrod.
We have provided it as a false argument.
The next parameter here is the parameters.
We want to change in what model?
And this should be in the form of a dictionary.
We have already created it and we have named.
Therefore, we have provided this bad MS here.
The Nexus and you'll equal to minus one since we want all the processing power of all system.
Then see the equal do three.
There's a sense for cross-validation.
And verbal equal to one.
And we want it scoring on the basis of the accuracy scored.
Let's create this.
Object.
Then we will fit to what extent and why train data?
On this grid search.
So we have trained over more than known to look at the best parameter we can use best.
And it's got bedrooms, underscore a tribute of this grid, search it.
So just write the name off your object and dot best underscore bedrooms.
This should give you the best barometer.
So here the best barometer for our model is see.
250 and Goll might well do the zero point zero zero one.
Now we are saving this model with the best parameter.
And another object that is radial SVM underscored classifier.
We are using this.
A swim grade underscored radial, and then we are using dot best underscore, assuming to underscore,
attribute, just run this.
Now we have the model that correspond to this well use of hyper parameter.
We can use the predicate function and accuracy function to find out the accuracy skort.
Yes, run this.
The accuracy for over this model is point six one.
As I've told you earlier, you might not get the best accuracy score because our data is very small.
We are working with large amount of data, say a million datapoint or a billion observations.
In that case, we'll get a lot better score with its search as compared to some random values of parameter.
So always strive to use grid search to optimize your parameters.
That's all for this lecture.
Thank you.