﻿1
00:00:00,133 --> 00:00:00,666
Okay.

2
00:00:00,666 --> 00:00:05,300
So now let's quickly do the same
for the SDR results in high resolution.

3
00:00:05,333 --> 00:00:07,866
So here we're going to create a new code
cell.

4
00:00:07,866 --> 00:00:09,733
And again let's do it efficiently.

5
00:00:09,733 --> 00:00:12,700
We're going to go to our polynomial
regression implementation.

6
00:00:12,700 --> 00:00:15,733
Scroll down here to find the code
for the high resolution.

7
00:00:16,033 --> 00:00:21,000
Select it copy it and go back to our SDR
implementation.

8
00:00:21,333 --> 00:00:22,133
These are here.

9
00:00:22,133 --> 00:00:25,133
And now again
let's see what we have to replace.

10
00:00:25,233 --> 00:00:25,533
All right.

11
00:00:25,533 --> 00:00:30,600
So first let's make the obvious change
again polynomial regression by SVR.

12
00:00:30,600 --> 00:00:33,033
And then same. Let's check row by row.

13
00:00:33,033 --> 00:00:35,266
So in the first two rows
what do we have to do.

14
00:00:35,266 --> 00:00:38,700
Well of course we have to reverse
the scaling for the two axis.

15
00:00:38,700 --> 00:00:41,200
Here. Right. Because x is still scaled.

16
00:00:41,200 --> 00:00:43,200
So we have to put that back
in the original scale

17
00:00:43,200 --> 00:00:46,500
so that we can get x grid
in the original scale as well.

18
00:00:46,666 --> 00:00:47,300
Okay.

19
00:00:47,300 --> 00:00:51,300
So let's again call our c x scale object

20
00:00:51,300 --> 00:00:55,400
from which we call again
to inverse underscore transform.

21
00:00:55,733 --> 00:00:58,733
There we go. Method applied to x.

22
00:00:58,800 --> 00:01:00,266
And then same for the second x.

23
00:01:00,266 --> 00:01:03,966
Here we call our c x scaler object

24
00:01:03,966 --> 00:01:08,000
from which we call the inverse
underscore transform.

25
00:01:08,033 --> 00:01:10,800
There we go. Method apply to x.

26
00:01:10,800 --> 00:01:13,733
Okay great
I think we're good for the first row.

27
00:01:13,733 --> 00:01:15,066
Now second row.

28
00:01:15,066 --> 00:01:19,200
The second row is actually fine because x
grid is now back into the original shape.

29
00:01:19,200 --> 00:01:21,066
So we don't have to change anything here.

30
00:01:21,066 --> 00:01:24,066
So then row number three. Well here same.

31
00:01:24,066 --> 00:01:27,900
We have to apply the inverse
transformation on both the inputs x

32
00:01:27,900 --> 00:01:28,766
and the output y.

33
00:01:28,766 --> 00:01:33,733
So let's do that starting with x
we call our SC x scatter object

34
00:01:33,733 --> 00:01:39,300
from which we call the inverse transform
method apply to x.

35
00:01:39,600 --> 00:01:40,433
And then same.

36
00:01:40,433 --> 00:01:46,033
Here we call our SC y square object from
which we applied inverse transform method.

37
00:01:46,033 --> 00:01:48,633
Here we go apply to y. Excellent.

38
00:01:48,633 --> 00:01:51,000
So now I think we're good
with row number three.

39
00:01:51,000 --> 00:01:53,000
And now let's move on to row number four.

40
00:01:53,000 --> 00:01:54,966
So in row number four x is fine.

41
00:01:54,966 --> 00:01:56,866
It's already back into the original scale.

42
00:01:56,866 --> 00:01:59,366
But the predictions are not fine.

43
00:01:59,366 --> 00:02:01,100
Of course
we're going to replace this whole

44
00:02:01,100 --> 00:02:03,700
prediction here
of the polynomial regression by.

45
00:02:03,700 --> 00:02:08,233
Actually let's make it efficient
by the prediction we got here.

46
00:02:08,233 --> 00:02:11,033
But of course
we need to replace x by x grid.

47
00:02:11,033 --> 00:02:12,500
So let's take all this.

48
00:02:12,500 --> 00:02:16,566
Let's scroll back down
and let's replace this line rect

49
00:02:16,566 --> 00:02:21,733
to predict fully rect fit
transform X grid by our SVR prediction,

50
00:02:21,733 --> 00:02:25,200
after which we replace
of course x by x grid.

51
00:02:25,733 --> 00:02:27,466
Okay, do you think we're done now?

52
00:02:27,466 --> 00:02:29,566
Well, actually, bad news,
we're not done yet.

53
00:02:29,566 --> 00:02:31,433
There's one final thing we need to do.

54
00:02:31,433 --> 00:02:32,633
Do you see what it is?

55
00:02:32,633 --> 00:02:36,266
Well, you notice that here
we apply the predict method to X grid.

56
00:02:36,266 --> 00:02:40,266
And x grid is not scaled because here
we apply the inverse transform of x

57
00:02:40,466 --> 00:02:41,500
when making x grid.

58
00:02:41,500 --> 00:02:44,933
So here we just need to apply
one last time I promise

59
00:02:45,100 --> 00:02:50,633
the x object next grid so that we get
the scaled values of x grid, so that.

60
00:02:50,633 --> 00:02:54,400
Therefore the predict method can make its
predictions in the right format.

61
00:02:54,633 --> 00:02:55,200
All right.

62
00:02:55,200 --> 00:02:57,900
So that was last little difficulty here.
So let's do this.

63
00:02:57,900 --> 00:03:00,300
Let's call again for the last time.

64
00:03:00,300 --> 00:03:04,400
Our scaler object X
from which we call that

65
00:03:04,400 --> 00:03:07,400
there it is transform method

66
00:03:07,400 --> 00:03:10,166
applied to this time x grit.

67
00:03:10,166 --> 00:03:12,633
Okay. So now I think we're really done.

68
00:03:12,633 --> 00:03:14,966
The only way to check
this is by running this cell.

69
00:03:14,966 --> 00:03:15,933
And let's see what we get.

70
00:03:15,933 --> 00:03:21,866
We get the beautiful curve
in high resolution of the SVR model.

71
00:03:21,866 --> 00:03:24,000
So congratulations.

72
00:03:24,000 --> 00:03:25,266
That was a pretty tough one.

73
00:03:25,266 --> 00:03:28,300
And if you did it all by yourself first
well double congrats.

74
00:03:28,966 --> 00:03:29,433
Okay.

75
00:03:29,433 --> 00:03:32,066
So now we're going to move on
to the next classification model

76
00:03:32,066 --> 00:03:34,800
which will be the decision tree
regression model.

77
00:03:34,800 --> 00:03:37,600
I look forward to seeing you
in its practical activity.

78
00:03:37,600 --> 00:03:39,666
And until then enjoy machine learning.
