In this video, we are going to learn how to create a steam boost model not.
This is going to be a little bit different from the models that we have been creating.
Usually we just had one test data and one train data in the form luvvie mentioned.
What is the dependent?
And what is the independent variable?
And we told what data to be used and the model was trained.
But for training a model using XY boost, we need to prepare the data in a particular format in that
format is called R B Matrix.
So we'll first learn how to get the data ready and that format in which it's Tibbles will be able to
run on it and train the model.
The package that we are going to use for this is Izzy Boost.
So if it is installed, you can just stay out of it.
Celebrity deliberate.
Eagleman If it is not, we will install the package.
The package it started will run Liberty Command.
Now to prepare the data.
First we have to separate the dependent and independent variables.
And when we separate the dependent variable, that is the variable that we want to predict.
That variable should be in the form of a Boolean added.
It should contain values.
True or false.
So if you remember my start, take Oscar.
Very well.
Contained value.
Zero or one.
I will create a new variable, Greenway, and this Greenway will contain boolean values.
It will contain true if static Oscar contained one.
And it will contain false if static Oscar contained ZEW.
So I'm checking here whether the values won or not.
If it is won, then it will have value.
True.
If it is zero, then it will have value.
False.
So that.
Does it underscore my.
And look at this train very, very well, it it does very well and it has values falls through True-Blue
and so on.
You can by train my head and I need to see all the values of train my.
Next for Green Eggs, we will.
We need to create a model matrix.
The point is that we cannot have any categorical variable containing categories.
We need to convert categorical variables to dummy variables.
That is the variable.
Should that have value only 011?
So if you have a categorical variable containing value, such as.
Yes and no.
For example, if we go and open the train dataset.
And we look at the X 3D available variable.
It has values.
Yes, I know.
And there is a genre variable which has values, drama, comedy, action and thriller.
These labels are not allowed in next reboost.
We need to convert these variables to numeric paper variables.
So one way of doing that is to create a dummy variable for these variable.
So a dummy variable of 3D available would have won if this value is.
Yes, and it will have zero if this value is no.
Similarly for Donald Variable, we will make N minus one.
Dummy variables.
That is.
There are four categories.
We will create four minus one.
That is three dummy variables.
The first time you variable will have value one wherever DeJohn already of evil has value.
Drama.
The second dummy variable of John, it will have value new one whenever the John Elway variable values
comedy.
The third will have value one whatever Dorna has value Trilla when all the three dummy variables are
zero.
John, it has a value of action.
So in this way, we will create dummy variables for all the categorical variables.
And a short way to do that is create a model matrix.
So we will create a new tree next video when?
It will have the values from model matrix function, which has this formula.
Any variable on the left of this delay will not be converted to dummy variables.
Variables on the right of this delay will be converted to the movie deals.
So you want all the other categorical variables to be converted to a dummy variable.
So there is a dark.
Then we have a minus one.
This is to delete the first column of the created dummy variables, the data to be.
Well, the one is Brain C..
Let's run this and we will look at three next so that you get a better understanding of what we have
created.
So this is the Kleenex.
So if we look at this next one, evil.
It has all these categorical variables converted to rebuild.
You can see that extreme liberal has now dummy variables.
John, it has three.
We should delete this extra dummy variable, which can.
Well, you know, and rest of it is ready.
So we'll just go and delete that extra variable.
To do that, we will write this green X gets green X
comma, minus two.
Will this minus 10 is because we want really deep gold column.
So we'll run this combine.
You can go to the train next day to confirm that the 12th column is gone.
So with this hour, Train X data is ready in the model matrix format.
Now, the same thing we need to do with the test.
But also will separate the Y and X, part of it will run best Y is equal to this condition so that we
have bestway indeed boolean format.
That is, if star take Oscar in S to C dataset is one, it will contain value.
True, if it is zero.
It will contain false will run this test y is created with proof false values.
Or test exile's.
Also, we'll run the same thing.
And we will believe these call column just to confirm they'll open their stakes scrawl and check if
it is again available at World Vision.
It does.
So we will copy the skyline to the change train to test.
I'm it.
And Test X now has grown to everyone's.
Now, as I told you, a extra boost takes input as a B matrix so two can create a D matrix.
This is the code that we are put on SGV door.
The matrix is the function.
Data is the expert.
The train X model that we created and label is the part that is the classification part that we want
to predict.
Similarly for test also, we will create this de matrix.
So we'll run these two commands to create the data and do the B Matrix format.
So by doing all this, we have prepared the data to be run into a SCV XY boost function.
Now we will use this X matrix to train the model so we use SD boost function data is equal to X matrix.
This is the data and drone is the number of iterations that the boasting algorithm will do for now.
I have ordered 250.
You can change it to 20 or 200 to see the performance objective.
I have said to my date softmax.
So let us see what are the objective options that we have.
I have pressed one on extra boost to openly help on S to boost.
So we'll put it best F1 to openly help what I see most in this.
We want to look at the objective barometer.
If you scroll down, you can see this is a task parameter.
In this, we specify the learning task.
If you're going to do linear regression, you use rig linear.
If you want to do logistic regression, you write rig logistic.
If you want the model to classify.
You can use multi softmax, which is setting the XY boost to do multiclass classification using softmax
objective.
So sense are objective risk classification here we will use multi softmax if you have the objective
of regression.
You can use these two neglection linear regression, logistic.
It is equal to pointy.
It does the learning barometer, which decide to learn in grade two, either can have values between
zero to one.
And if you look at the help section, it is telling you that Iida control seed learning read.
So if you put a very small value, it would mean that you need to run the model for more number of eight
so that it learns completely.
If you have large value of reader, that is learning is very fast.
You can reduce the number of round.
But in that scenario, the model may not be able to completely fit the data.
So it is preferable to keep a lower value for ETR and a higher value of and drone so that your model
fits the data completely.
Nonetheless is a parameter which is specific to this objective.
That is, since it is a multiclass classification objective.
We need to specify the number of classes in that objective variable.
Since outdoor activity will has only two classes, so class with you will actually well, you have to
max depth control the growth of the three.
So Max depth value of hundred means that the final three has can have a maximum depth of hundred levied
by a default.
It has a maximum depth of six.
So I'll run this, come on.
So for the 50 round, those who have dehydration that complete and the value of a booze model are stored
in this Ezzy boosting variable.
Now, using this extreme boosting variable, we will predict devalues and there's a zip rate variable.
So we will again use the predict function, exhibiting the model name X Matrix, underscore P is for
the test set.
So this is the D matrix of the test set.
If we run this timeline, the predicted values of the glasses is in the x deep red variable.
Now to see the prediction accuracy of this model, we will run this table.
Come on, let's create a conclusion matrix.
And you can see that our model is correctly classifying these two sets of observations, that is 31
had predicted values, although zero and actual value was also zero or false.
And these 43 were predicted as one and actual results one.
So far, 74 out of 113.
We are getting late predictions on that test.
So 74
out of 13 is correct.
So basically, we have a prediction, accuracy of sixty five point five percent.
We can change the parameter values to get different prediction accuracy.
So probably if I decrease the depth to in.
And then this mortal again.
And now I predict devalues.
I know what they did.
They will.
Now I'm correctly predicting seventy one cases instead of 70 focuses.
So reducing the depth in this scenario has reduced the accuracy of my model.
So you can check it for different values of and grown different values of Iida, different values of
Max stepped and seedy prediction, accuracy and different values of different parameters.
If you know how to do looping, that is if you know how to run loops and the software, you can also
run a loop and find out the different prediction accuracies at different values off and on.
So probably you can run a loop on and on changing its value from 10 to under.
And for each scenario you find out deep prediction, accuracy, wherever you get the best prediction,
accuracy.
You keep that value of Hendron.
That is something we will not be covering in this course.
However, that is also possible.
So this is how we do X GS boosting.
And ah, you have seen that initially when we created very simple busy entries.
We could plot them.
We could easily interpret them.
And we can use those visuals in our presentations easily.
They basically were very interpretable.
But to increase the prediction accuracy, we traded off that in dependability and regard prediction,
accuracy.
We talked about on timbale method, bagging random forest and boosting in boosting.
We further discussed gradient boosting Adam hosting an extra boosting.
All of these methods showed great improvement in prediction accuracy as compared to a simple decision
tree or a prone decision tree.
So now you know both parts.
How to create the simple decision tree and how to create a very advanced Gaudette prediction.
This is tree.