Okay.
So now let's quickly do the same for the SDR results in high resolution.
So here we're going to create a new code cell.
And again let's do it efficiently.
We're going to go to our polynomial regression implementation.
Scroll down here to find the code for the high resolution.
Select it copy it and go back to our SDR implementation.
These are here.
And now again let's see what we have to replace.
All right.
So first let's make the obvious change again polynomial regression by SVR.
And then same. Let's check row by row.
So in the first two rows what do we have to do.
Well of course we have to reverse the scaling for the two axis.
Here. Right. Because x is still scaled.
So we have to put that back in the original scale
so that we can get x grid in the original scale as well.
Okay.
So let's again call our c x scale object
from which we call again to inverse underscore transform.
There we go. Method applied to x.
And then same for the second x.
Here we call our c x scaler object
from which we call the inverse underscore transform.
There we go. Method apply to x.
Okay great I think we're good for the first row.
Now second row.
The second row is actually fine because x grid is now back into the original shape.
So we don't have to change anything here.
So then row number three. Well here same.
We have to apply the inverse transformation on both the inputs x
and the output y.
So let's do that starting with x we call our SC x scatter object
from which we call the inverse transform method apply to x.
And then same.
Here we call our SC y square object from which we applied inverse transform method.
Here we go apply to y. Excellent.
So now I think we're good with row number three.
And now let's move on to row number four.
So in row number four x is fine.
It's already back into the original scale.
But the predictions are not fine.
Of course we're going to replace this whole
prediction here of the polynomial regression by.
Actually let's make it efficient by the prediction we got here.
But of course we need to replace x by x grid.
So let's take all this.
Let's scroll back down and let's replace this line rect
to predict fully rect fit transform X grid by our SVR prediction,
after which we replace of course x by x grid.
Okay, do you think we're done now?
Well, actually, bad news, we're not done yet.
There's one final thing we need to do.
Do you see what it is?
Well, you notice that here we apply the predict method to X grid.
And x grid is not scaled because here we apply the inverse transform of x
when making x grid.
So here we just need to apply one last time I promise
the x object next grid so that we get the scaled values of x grid, so that.
Therefore the predict method can make its predictions in the right format.
All right.
So that was last little difficulty here. So let's do this.
Let's call again for the last time.
Our scaler object X from which we call that
there it is transform method
applied to this time x grit.
Okay. So now I think we're really done.
The only way to check this is by running this cell.
And let's see what we get.
We get the beautiful curve in high resolution of the SVR model.
So congratulations.
That was a pretty tough one.
And if you did it all by yourself first well double congrats.
Okay.
So now we're going to move on to the next classification model
which will be the decision tree regression model.
I look forward to seeing you in its practical activity.
And until then enjoy machine learning.