Hello my friends.
Happy to see you again.
Now for this new section and mostly this new practical activity
where we're going to build together the random forest regression.
So this is our last model of the regression part.
And we're going to build it very quickly and efficiently.
Because actually it looks very much like the decision tree regression model.
So we will be very efficient.
And besides right after this section comes the most important section for you.
It is the section where Kirill and I will explain to you how to not only evaluate
your regression models, but also how to select the best one.
So right after we're done with the random forest regression,
we will actually have a new data set with, you know, multiple features.
You know, like more real world data set.
And I will show you how to use your regression code templates to quickly plug
your regression models onto the data set and quickly find the best one.
All right.
So that will be very important for you to learn how to handle.
But now let's smash our last regression model the random forest regression.
And before we start, let's just make sure everyone here is on the same page.
I give you the link to this folder right before this tutorial in the article.
So make sure to connect to that link.
And now we should all be on the same page.
So we're all going to go into part two regression.
Then we're going to go
this time to the last regression model which is our random forest regression.
And then we're going to start as usual with Python.
And this folder contains once again the position salaries data set.
And of course the random forest regression implementation in the Ipynb format,
which you can therefore open with either Google Colaboratory or Jupyter Notebook.
And as far as I'm concerned, as usual I'm going to open it with
Google Colaboratory.
So there we go.
Let's start implementing the random forest regression model.
So now it is, you know, laying out the notebook.
And in a second we should have it.
There we go.
All right.
So as usual this is in read only mode.
So we're going to quickly create a copy so that we can re-implement it.
We're not going to re-implement it from scratch because it is really similar
as the decision tree regression model.
So you will see that we will only re-implement one code cell.
And if you know, you come here in this regression
folder for the first time with random forest regression, well,
I encourage you to have a look at decision tree regression first, because indeed
all these code cells were explained right.
But this time we're only going to delete this one.
That's where we,
you know, train the random forest regression model on the whole data set.
And then all the rest is same.
It is all the same as decision tree regression.
We import first the libraries, then we import the data set.
Then after, you know, the training of the random forest regression
model on the whole data set,
we predict this new result, which is the exact same syntax.
Actually I'm going to hide this now.
So this is the exact same syntax as the decision tree regression model.
And then here that's the same.
This is the exact same code that we implement
to visualize the random forest regression result.
All right.
So let's just keep this because we did it many times.
And I'm sure you're looking forward to that final section
where you know everything is going to make sense.
Because indeed you will learn how to use this regression
folder containing all these code templates for regression.
And you will learn how to understand which model to choose.
And, you know, select the best one for your data set.
I will explain everything in this last section,
but for now, let's implement that only missing code
cell to train the random forest regression model on the whole dataset.
So let's add a new code cell here.
And now there you go.
You could once again
totally do it yourself by looking at some documentation online.
And actually, well, let's do it together.
This time we're going to pretend that, you know, we would like to build a random
forest regression model and train it on the data set,
and that I have absolutely no clue on how to build it, or you know,
which Scikit-Learn class to use to build it.
So let's see.
Well, what I would do, as I said, would be to go to Google or Bing.
So here is Google.
And I would type here in the search bar.
Well you know for example scikit learn.
All right.
And then random forest regression this one right.
Even the suggestion helps. So that's perfect.
Then pressing enter.
And then I would go for the link of scikit learn.
You know the scikit learn website.
And this will usually be the first link as it is the case right here.
So let's click this.
And normally I should find side the exact name of the random forest regression
class, and also the name of the module that contains this class.
And indeed that is exactly what we see in big here.
This is the whole library scikit learn.
This is the module that contains the class we want.
And this is the name of the class.
So there you go.
Well let's actually take everything here.
And we will get this bit.
Because this is not exactly what we have to write in Python.
But I'm sure you'll know how to adapt this.
There you go.
That's what I wanted to show you.
You know, it's very, very easy to find online.
The name of class that allows to build the model you want, right?
I just had to type scikit learn and random forest regression
and just go to the first link.
So you see very very easy.
So let's go back to our implementation and let's start building
this random forest regression model and train it on the whole data set.
So now I'm going to paste what I've just copied.
Because indeed, in order to import this class
I simply need to add here at the beginning of from right from scikit learn
and then from the in symbol module of scikit learn.
Well I'm going to import that random forest regressor class.