﻿1
00:00:00,600 --> 00:00:00,900
All right.

2
00:00:00,900 --> 00:00:02,600
So that's a really bad prediction.

3
00:00:02,600 --> 00:00:06,900
So now we're going to get the good
prediction which we can clearly see here.

4
00:00:06,933 --> 00:00:08,400
You know that's 6.5.

5
00:00:08,400 --> 00:00:10,600
And we'll get a prediction around here

6
00:00:10,600 --> 00:00:14,166
which will correspond indeed to the salary
that this person mentioned.

7
00:00:14,533 --> 00:00:15,600
So let's do this.

8
00:00:15,600 --> 00:00:18,366
Let's create a new code cell here.

9
00:00:18,366 --> 00:00:22,100
And to get that prediction
we're going to do it efficiently

10
00:00:22,100 --> 00:00:26,166
I'm going to copy this and paste here.

11
00:00:26,400 --> 00:00:29,633
And now once again I would like you
to press pause on this video

12
00:00:29,766 --> 00:00:32,633
and figure out what we have
to replace here to indeed

13
00:00:32,633 --> 00:00:38,366
get the predicted salary resulting
off our polynomial regression model.

14
00:00:38,400 --> 00:00:41,400
So please press pause and then I'll
tell you the solution right away.

15
00:00:42,766 --> 00:00:44,433
Okay. Let's do this.

16
00:00:44,433 --> 00:00:44,700
All right.

17
00:00:44,700 --> 00:00:45,100
So first

18
00:00:45,100 --> 00:00:48,200
the obvious thing you had to change is
of course the name of your regressor.

19
00:00:48,200 --> 00:00:52,800
Because for polynomial regression
we named our regressor linear two.

20
00:00:53,200 --> 00:00:55,733
And then executives same thing as before.

21
00:00:55,733 --> 00:00:59,433
Here we can't input that single
position level.

22
00:00:59,433 --> 00:01:02,433
You know
coming from the matrix of single feature.

23
00:01:02,633 --> 00:01:07,800
But instead well we have to exactly input,
you know, the features of this equation

24
00:01:08,000 --> 00:01:13,766
where x1 is equal to 6.5 and therefore
what we need to input as features

25
00:01:13,966 --> 00:01:17,733
is this array
composed of the following features values

26
00:01:17,833 --> 00:01:21,900
6.5 for x1,
then 6.5 squared for x1 squared,

27
00:01:22,133 --> 00:01:26,400
then 6.5 at the power of three
and 6.5 at the power of four.

28
00:01:26,400 --> 00:01:30,333
Because now we have built a polynomial
regression model with degree four.

29
00:01:30,600 --> 00:01:31,133
All right.

30
00:01:31,133 --> 00:01:33,833
So here
the exact thing that we have to predict.

31
00:01:33,833 --> 00:01:37,900
And we can actually input that efficiently
by, you know,

32
00:01:38,100 --> 00:01:42,300
taking exactly what we input here
in the predict method,

33
00:01:42,633 --> 00:01:46,366
that fully read object from which
we call the fit transform method

34
00:01:46,500 --> 00:01:51,033
to transform this matrix of single feature
X into this

35
00:01:51,033 --> 00:01:54,500
matrix composed of the several features
at the different powers.

36
00:01:54,500 --> 00:01:58,200
And here, well,
of course, the feature value

37
00:01:58,200 --> 00:02:03,100
that we will input inside this fit
transfer method will not be x,

38
00:02:03,100 --> 00:02:07,633
but not 6.5 directly like you know before.

39
00:02:07,800 --> 00:02:13,800
But once again, a 2D array containing
the value of 6.5 to cell of 6.5.

40
00:02:14,033 --> 00:02:15,900
And so that's exactly the same as before.

41
00:02:15,900 --> 00:02:19,866
We need to enter this 6.5 value
inside an array.

42
00:02:20,166 --> 00:02:22,166
You know just before we had x.

43
00:02:22,166 --> 00:02:23,500
Here x is an array.

44
00:02:23,500 --> 00:02:27,000
And now we have to input 6.5 in a 2D array
just like that.

45
00:02:27,266 --> 00:02:28,600
And now there you go.

46
00:02:28,600 --> 00:02:30,400
We are ready to get r

47
00:02:30,400 --> 00:02:33,533
predicted salary resulting
from the polynomial regression model.

48
00:02:34,000 --> 00:02:39,866
So let's find out right away what is that
predicted salary and wonderful.

49
00:02:39,866 --> 00:02:43,333
So the predicted salary is 158.

50
00:02:43,333 --> 00:02:48,300
Well actually $159,000
which is super close

51
00:02:48,566 --> 00:02:51,400
to the salary mentioned by this person,

52
00:02:51,400 --> 00:02:54,466
you know, as the previous salary earners
in the previous company.

53
00:02:54,733 --> 00:02:59,766
So now we can be 100% confident
to hire this person because not only

54
00:02:59,766 --> 00:03:03,766
it is a good fit for the job,
but also it is a very honest person.

55
00:03:04,133 --> 00:03:07,200
And we figured that out
with polynomial regression.

56
00:03:07,666 --> 00:03:09,000
So congratulations.

57
00:03:09,000 --> 00:03:10,433
We also have this case study.

58
00:03:10,433 --> 00:03:11,833
Not only we solved this case,

59
00:03:11,833 --> 00:03:15,433
but you now know how to build
a polynomial regression model.

60
00:03:15,433 --> 00:03:17,500
And you added that in your toolkit.

61
00:03:17,500 --> 00:03:20,266
This is your first nonlinear regression
model.

62
00:03:20,266 --> 00:03:21,700
Congratulations for that.

63
00:03:21,700 --> 00:03:25,933
Now we're going to build three other ones
starting with the SVR support

64
00:03:25,933 --> 00:03:27,233
vector for regression.

65
00:03:27,233 --> 00:03:29,966
And that's
what we'll do in the next section.

66
00:03:29,966 --> 00:03:30,766
Now for those of you

67
00:03:30,766 --> 00:03:35,100
who also want to study R
well you'll find that same implementation.

68
00:03:35,100 --> 00:03:37,266
But in R of course in the next section.

69
00:03:37,266 --> 00:03:38,933
And for those of you
who only want to learn

70
00:03:38,933 --> 00:03:41,133
Python will join me in this section
after that

71
00:03:41,133 --> 00:03:45,500
to first learn about SVR with Kirill
and then implement the SVR model

72
00:03:45,500 --> 00:03:48,233
with me, which will be, by the way,
on the same data

73
00:03:48,233 --> 00:03:51,233
set with the same case study,
so that we can actually compare

74
00:03:51,300 --> 00:03:54,300
the different results
of our non-linear regression models.

75
00:03:54,533 --> 00:03:56,933
So I can't wait to see you
in these next sections.

76
00:03:56,933 --> 00:03:58,800
And until then, enjoy machine learning.
