Hello my friends.
Welcome to this new section on now Decision Tree Regression.
So we're about to tackle a new practical activity where we will
all learn together how to build the decision tree regression model.
You will see that it will be super easy based on what we did before.
You know, with all the feature scaling and inverse transformation of the SVR, now
we will not have to apply feature scaling and therefore we will just smash this.
All right.
Are you ready?
Are you ready to start.
Before we go into this part two regression folder,
let's just make sure that everyone here is on the same page.
I give you the link to this folder just before this tutorial.
So you just have to click the link.
And then now we should all be on the same page.
So we're going to go into part two regression.
And then section eight decision tree regression.
We are almost at the end of the regression part.
Congratulations for the great progress you've made so far.
And now we're going to go,
of course, to Python in order to fine our files for this section.
So there are two files here.
The Python implementation of the decision tree regression model in Ipynb format,
which you can open with either Google Colab or Jupyter Notebook.
And our same position salaries data set
containing that same data of the previous company, showing the
different position levels from 1 to 10, corresponding to business analyst to CEO,
and the corresponding salaries from 45,000 to $1 million per year.
All right.
So this time we're going to train a decision tree regression model
to understand the correlations between these two features.
However, I have to say something important here.
The decision tree regression model is not really well adapted to,
you know, these simple data sets,
you know, with only one feature and the dependent variable vector.
You'll see what I mean by that at the end, you know, on the visualization graphs.
But having said that, I would like you not to worry
because to implement one of the decision tree regression model
we were about to build will still work on any other data sets.
You know, with several features.
Here we have one feature, but the code we were about to make will work
for data set having any number of features.
All right.
So even if the results won't be beautiful in the end, well,
you will still be able to use this decision tree regression implementation
on your other data sets, even if they have hundreds of features.
But then make sure to add some data preprocessing tools if needed.
For example, if your data set has some categorical data
or missing data, but you don't have to apply feature scaling
for decision tree regression, and neither for random forest regression,
which will be our next model, you know, in the next section.
All right.
So that's the important thing I wanted to say here.
And now we're going to start our implementation by double clicking
this file here which you can either open with Google Collab
if you like, Google Collab like me or Jupyter Notebook.
All right.
So choose your favorite.
And now let's open Google Colaboratory.
It is opening the notebook and
here we go.
That's the whole implementation.
All right.
So as usual now we're going to create a copy of this notebook.
Because this is in read only mode which means you can't modify it or recode
it. So we're going to go to file here and then click here.
Save a copy in drive.
And this will as you can see create a copy of this notebook
on which you will be able to recode on it.
You know, re-implement this decision tree regression model.
Perfect.
So now you know the next step.
We're going to delete the code cells.
But since it is the third time we actually work on this position salaries data set.
And of course each time it's the same two first steps of the data
preprocessing phase importing the libraries and importing the data sets.
Well, this time we won't re-implement this.
We will just leave them and not delete them.
So we will just delete all the code cells from here.
You know, from the step training, the decision tree
regression model on the whole data set. All right.
So let's do this.
Let's start by deleting this one because we will re-implement it together
then this one.
And now this one.
All right.
Perfect.
Also you can notice that at the end we will only visualize
the decision tree regression results in high resolution.
Because you will see and I will show this to you
that the decision tree regression results in low resolution.
You know, without applying the grid solution will absolutely not make sense.
And I will explain that at the end of this section.