All right.
So perfect.
So now that everything is essentially said,
let's tackle this data preprocessing phase.
So we're going to do this very efficiently.
I'm going to go to my data preprocessing template.
And I'm going to copy paste each of these code cells.
You know the first ones.
So I'm creating a new code cell here pasting that here.
That's for importing the libraries.
Then we're going to take care of the second step of data preprocessing
which is importing the data set creating therefore.
And you could cell here.
And let's first take care of this.
You know the last one the easy one.
Splitting the data set into the training set and the test set
and pasting that in a new code cell right here.
All right. Perfect.
And now before we encode the categorical data, let's just make sure
to replace what's necessary here in this template.
And once again that's the beauty of the template.
We only need to replace one little thing which is of course the name of the data
set here. Right.
And the name is of course 50 underscore capital s startups dot CSV.
So there we go.
Let's do this 50 underscore startups grid.
And as a reminder we don't have to change anything here
because this automatically selects all the columns except the last one.
And therefore all the four features here.
So that's perfect.
And this line of code automatically selects
the last column, which means the dependent variable profit.
Okay.
So once again we tackled data preprocessing in a flashlight.
And now we just have this one less tool to add in our data
preprocessing phase which is include that state variable here.
So to do this we're going to get our data preprocessing tools which you have
in your part1 data preprocessing folder.
And now we're going to scroll down to find
that tool that you know encodes the categorical data.
So remember we actually have two sub tools here if I may say that
first tool that applies one hot encoding, which is exactly what we want.
And that tool that just encodes a binary variable
into zero and one and of course what we need is this one.
So I'm just going to copy paste that piece of code.
And then I'm going to paste that right here
in a new code cell to encode categorical data.
And now your turn, your turn to think and figure out what we need to do next.
Please press pause on this video and figure out what you have
to change here in order to indeed apply one hot encoding on our data set.
I'll give you a hint.
You only have one little thing to change and then you'll be good to go.
So please press pause.
Okay.
And now I'm going to give you the solution.
So the only thing that you had to change here is that index here.
Remember this corresponds to the index of the column.
You want to apply one hot encoding.
And in our previous data set you know data dot CSV.
Well remember the categorical variable was the first column.
That's why we put index zero here.
But for new data set the categorical variable is actually the fourth column.
But be careful.
Remember that indexes in Python start from zero.
Therefore this column has index zero. This one is index one.
This one is exactly two and this one has index three.
And therefore the index you need to change
here is of course three right.
So this will apply one hot encoding to the column of index three in your data set.
Therefore exactly this date column perfect.
So we're done with the data preprocessing phase.
So now we are going to observe the results of what we just built.
You know just in terms of data preprocessing.
And therefore we're going to do several things here.
First we're going to upload the data set into our notebook.
Right.
And to do this we click this little folder here and then upload.
All right.
So as usual my machine learning dataset folder is on my desktop.
So we're going to go inside. Make sure to find it on your machine.
Then we're going to go to part to regression.
Then section five multiple linear regression in Python.
And there we go.
That's the data set which we need to open and upload into our notebook.
All right it is uploaded.
And now what we're going to do is we're going to run each of these cells
that we just made.
But I'm going to add a few prints,
you know, so that you can really see what we did.
You know how the different matrix of features, independent variable vector
are created and modified belong to data preprocessing phase.