All right.
So that's a really bad prediction.
So now we're going to get the good prediction which we can clearly see here.
You know that's 6.5.
And we'll get a prediction around here
which will correspond indeed to the salary that this person mentioned.
So let's do this.
Let's create a new code cell here.
And to get that prediction we're going to do it efficiently
I'm going to copy this and paste here.
And now once again I would like you to press pause on this video
and figure out what we have to replace here to indeed
get the predicted salary resulting off our polynomial regression model.
So please press pause and then I'll tell you the solution right away.
Okay. Let's do this.
All right.
So first
the obvious thing you had to change is of course the name of your regressor.
Because for polynomial regression we named our regressor linear two.
And then executives same thing as before.
Here we can't input that single position level.
You know coming from the matrix of single feature.
But instead well we have to exactly input, you know, the features of this equation
where x1 is equal to 6.5 and therefore what we need to input as features
is this array composed of the following features values
6.5 for x1, then 6.5 squared for x1 squared,
then 6.5 at the power of three and 6.5 at the power of four.
Because now we have built a polynomial regression model with degree four.
All right.
So here the exact thing that we have to predict.
And we can actually input that efficiently by, you know,
taking exactly what we input here in the predict method,
that fully read object from which we call the fit transform method
to transform this matrix of single feature X into this
matrix composed of the several features at the different powers.
And here, well, of course, the feature value
that we will input inside this fit transfer method will not be x,
but not 6.5 directly like you know before.
But once again, a 2D array containing the value of 6.5 to cell of 6.5.
And so that's exactly the same as before.
We need to enter this 6.5 value inside an array.
You know just before we had x.
Here x is an array.
And now we have to input 6.5 in a 2D array just like that.
And now there you go.
We are ready to get r
predicted salary resulting from the polynomial regression model.
So let's find out right away what is that predicted salary and wonderful.
So the predicted salary is 158.
Well actually $159,000 which is super close
to the salary mentioned by this person,
you know, as the previous salary earners in the previous company.
So now we can be 100% confident to hire this person because not only
it is a good fit for the job, but also it is a very honest person.
And we figured that out with polynomial regression.
So congratulations.
We also have this case study.
Not only we solved this case,
but you now know how to build a polynomial regression model.
And you added that in your toolkit.
This is your first nonlinear regression model.
Congratulations for that.
Now we're going to build three other ones starting with the SVR support
vector for regression.
And that's what we'll do in the next section.
Now for those of you
who also want to study R well you'll find that same implementation.
But in R of course in the next section.
And for those of you who only want to learn
Python will join me in this section after that
to first learn about SVR with Kirill and then implement the SVR model
with me, which will be, by the way, on the same data
set with the same case study, so that we can actually compare
the different results of our non-linear regression models.
So I can't wait to see you in these next sections.
And until then, enjoy machine learning.