Hello and welcome to this art tutorial.
So we already built two regression models.
It was a simple linear regression and the multiple linear regression.
And today in this tutorial we will start with polynomial regression.
So as usual let's prepare the workspace by setting the right folder
as working directory.
So right now I'm going to my Machine learning A-Z folder.
Part two regression then section polynomial regression.
And here is the right folder.
Make sure that you have the position salary csv file.
And you can click on this more button here.
And then set as working directory.
And now let's start with the usual first step of making a machine learning model.
So this first step is of course the data pre-processing step.
So to be efficient I'm
going to go to my data pre-processing template that we made in part one.
I'm going to select everything in the template
copy and
paste it in my polynomial regression model.
This way okay.
And now we just need to change a few things.
So the first thing we need to change is the name of the data set.
So it's not data here.
The data was the name of the data set in the pre-processing part.
But now in this regression part
the name of the data set is position underscore salaries.
So here we'll write position
underscore salaries.
And now let's select this line
and execute to have a look at our data set.
Okay.
And now let's see what will be our machine learning mission.
So we are a human resource team working for a big company.
And we are about to hire a new employee in this company.
So this new employee seems to be great a good fit for the job.
And we are about to make an offer to this potential new employee.
And now it's time to negotiate.
Negotiate on
what is going to be the future salary of this new employee in the company.
And so, at the beginning of the negotiation,
this new employee is telling that he's had 20 plus years of experience
and eventually earns 160 K annual salary in its previous company.
So this employee is asking for at least more than 160 K.
However, there is someone in the HR team that is kind of a control
freak and always fantasized about being a detective.
So suddenly decides to call the previous employee to check that info.
You know that info about the previous 160 K
annual salary of this future potential new employee.
But unfortunately, all the info that this person
manages to get are these info here.
The simple table of salaries for these ten different positions
in the previous company.
So this HR member of the team runs a simple analysis on Excel or Google
Sheets, and actually observes that there is a nonlinear relationship
between these position levels and their associated salaries.
However, and moreover,
this HR guy could get another very relevant info.
This other relevant info is that this new employee that is about to be hired
has been a region manager for two years now in the previous company.
And that usually takes an average four years to jump
from being a region manager to a partner.
So this new employee about to be hired
was kind of halfway between level six and level seven.
And therefore we can say he was level 6.5.
So now this H.R.
Guy is getting all excited because he's telling to the team
that he can build a bluffing detector using regression models
to predict if this new employee is bluffing about its salary.
So at the beginning, the team finds it a little weird,
but it's kind of curious to see what's going to happen.
So here is the mission.
This new employee that is about to be hired is telling
that its annual salary was 160 K in the previous company.
Let's use polynomial regression to build a bluffing detector to predict
if it's truth or bluff.