In this video, we are going to learn how to train the aggression as a model on our data.
The only difference between classification SBM and Diggnation SBM is the type of at this point we're
able to do very well.
We are trying to predict if that variable is having classes.
We done a classification model.
If that variable has continuous values, we don't know Diggnation SVM.
So to run a regression, SBM will be using this dataset, which is move integration.
This dataset is also attached in the resources section.
And you can download it from the.
We need to do all the initial steps again.
That is, we will import the data.
We will get that data ready for analysis.
Is that they tend good test and train the U.S. training data to train aggregation model.
And we will use the test data to check out its performance.
So the first step is importing the data.
You know how to import data from us?
Yes, we find we just need to give the location of the file a link that it has headers and use the lead
NTSB function.
Run this on to import the data and this D.F. video will is created, this data frame has 18 variables.
Let us look at this data.
It has all the same variables, only that the last variable is now election.
We are trying to predict the total box office collection of the movies.
This is all these variables.
So how much did it spend on marketing?
How much did it spend on production or what did budget or does lead actor and actress rating and so
on.
So this is these variables.
We are trying to find out the total box office collection of that particular movie.
So this data is important.
Now we have to get this data ready for analysis.
We did this earlier also.
I'm only covering missing value imputation in data processing.
There are other parts also like outlier treatment, looking at correlations, plotting histograms and
so on.
If we are doing only missing value in prediction.
So to check which variable has missing values, then somebody.
And we see that time taken variable as in is.
To remove the end is within this command in which we find ourselves in time taken very well, which
has any, and we replaced the value in those cells using the mean of all the other values in that would
evil.
So we done this.
Come on.
Then we go back and take somebody to confirm that nobody below has.
And these.
The next step we did was to do our best transplant.
So we have a dataset of 506 observations.
If we use all of them to Apprendi model, we will not know how the model will perform on previously
unseen data.
So we will make two parts of this data.
80 percent of the data will be used to train the model, 20 percent of the data we'll keep.
And we will use it to take the performance of this model so that we know how this model perform on previously
unseen data.
To do pestilence, plague.
We use this package called the adults.
It has already installed, but it is not active.
So I'll run this library.
Go on.
Only if it is not installed also for you.
You can Banda's installer packages.
Come on.
So I'll run this command.
And the see it back.
Is not active.
Then we will set seed so that we both get the same split on this dataset.
So I set a seed of zero.
And then we create a variable called split.
This plate has values through and also and 80 percent of the values in this split variable will be true
and nearly 20 percent will be false.
Whatever the value is through the input, those observations of the D.F. data set in train.
And we put those observations of the of dataset.
We have split values, falls into essed dataset.
So they'll run both of these commands.
And you can see that in my brain said, I have three ninety nine observations, and in my estimate I
have wondered 107 observations.
So they'll use this train set supremely model and this desk set to test the performance.
Now the data is ready.
We just need to bring it on the SBM model.
We use SBM function.
We need this package called even zero seven one.
It is both installed and active in my station of art.
If it is not installed or active, you can run these commands.
I'm not going to run them because it is active for me.
Next comes the SBM function, which we use to train the model in support vector machines.
The only defense from classification is that now the variable is collection instead of Star Trek.
Oscar, this collection has numeric values.
So by default, this SBM function will run a regression model.
If it had four values, it would have run classification model.
So you either do you can specifically specify that it is to be decoration by using D a parameter or
you can just do the default values.
This is D APR dependent variable data.
We are going to uses three in data set that we created that meant for now is linear.
I would suggest that you try out polynomial and radial on your own.
Cost.
We are going to set as zero point zero one, although you can use the dual function to find out that
value of cost that you can get minimum estimate.
So I named this video bill as to unfit for immigration and I would underscore mine and we will look
at somebody of this as we, in fact are so that we know what is contained in this.
So this is an integration type with a covenant lenient cost set of datapoint due to one.
And these are some Diggnation parameters.
And this and this model has 326 support makers now using this SBM fit.
Are we are going to predict the values of collection on the basic.
So we use to predict function models, assume fit art.
And the data to be used as ist.
And these values will be saved in white bread.
So they bet on this come on vibrate.
Ah, as predicted, collection values.
So if you want to look at my prayer time, you can just vibrate out.
And done it.
And you can see all the predicted values at.
However, if we need to compare the performance of this model with any other model in regulation, one
of the parameters that we use is mean squared error, mean squared error is the mean of squared defense
of predicted values and the accuracy.
So here we find the difference between predicted, which is daughton vibrate.
And the actual Vidis desk collection.
We square it and we find the mean of all these values when we are comparing masc values.
Whichever model has lowered masc value is benefiting D.
S digga.
So when you're trying it out with binomial comment or radial cardinal or you are trying or different
values of cost, you should compare the MSE on the basic predictive values on the tested and find out
the MASC value using those predicted values.
Whichever model has lowered masc values, that model should be used.
So here I'm getting an MSU value of ninety nine million nearly.
If you want to compare it with a radial kidney just for radial head.
Specify gama value of, say, one
train, the model
predicted values and find out the MCO radial direction.
And you can see that the radial model as an masc of 259 million.
Although you can t do any of cost and Dhamar to find out a much better masc, but this is suggesting
that there is more of a linear relationship between the variables than a nonlinear relationship.
So in this way, by importing the data, getting it ready, splitting into two two parts, training
the model on the train set and testing it performance on the descent.
These are all the steps that we take to create a regulation model using SVM.