﻿1
00:00:00,233 --> 00:00:01,166
Hello, my friends.

2
00:00:01,166 --> 00:00:01,633
All right.

3
00:00:01,633 --> 00:00:02,266
Excellent.

4
00:00:02,266 --> 00:00:05,533
We already did the essentials
with data preprocessing.

5
00:00:05,533 --> 00:00:08,533
By importing the libraries
and importing the data set.

6
00:00:08,566 --> 00:00:11,300
And now.
I'd like us to particularly focus.

7
00:00:11,300 --> 00:00:12,166
On this.

8
00:00:12,166 --> 00:00:14,800
Feature scaling that we're about to do.

9
00:00:14,800 --> 00:00:19,533
So I've already taught you feature
scaling in the data preprocessing part.

10
00:00:19,533 --> 00:00:22,233
You know, part one where indeed
we implemented.

11
00:00:22,233 --> 00:00:26,333
Together this feature scaling tool at the
very. End.

12
00:00:26,533 --> 00:00:28,500
You know, feature scaling where we.

13
00:00:28,500 --> 00:00:30,400
Learned. How to scale with.

14
00:00:30,400 --> 00:00:33,466
Standardization,
the training set and the test set.

15
00:00:33,466 --> 00:00:35,800
Separately. Okay. So that's what we did.

16
00:00:35,800 --> 00:00:37,566
Now we are in a slightly.

17
00:00:37,566 --> 00:00:38,833
Different situation.

18
00:00:38,833 --> 00:00:41,366
In the sense that indeed. We.

19
00:00:41,366 --> 00:00:43,833
Do not have. A split of the data set.

20
00:00:43,833 --> 00:00:45,400
Between a training set and a test set.

21
00:00:45,400 --> 00:00:48,666
And that, I remind, is because
we want to leverage the maximum data

22
00:00:48,966 --> 00:00:52,900
in order to learn the correlations between
the business levels and the salaries.

23
00:00:53,266 --> 00:00:58,366
So the first thing is we will actually
apply exceptionally features killing.

24
00:00:58,366 --> 00:01:00,966
On the. Whole matrix of features x.

25
00:01:00,966 --> 00:01:04,866
Then the second important point
and the second difference with.

26
00:01:04,866 --> 00:01:06,100
What I taught you before.

27
00:01:06,100 --> 00:01:07,533
In the same day.

28
00:01:07,533 --> 00:01:09,733
Reprocessing tools. Implementation.

29
00:01:09,733 --> 00:01:10,400
Is the fact.

30
00:01:10,400 --> 00:01:13,366
That in this situation, we only.

31
00:01:13,366 --> 00:01:17,366
Applied feature
scaling to the features, right?

32
00:01:17,400 --> 00:01:19,133
We only applied feature scaling.

33
00:01:19,133 --> 00:01:20,400
To Xtrain and X.

34
00:01:20,400 --> 00:01:22,800
Which are the features of respectively
the training.

35
00:01:22,800 --> 00:01:24,433
Set and to test it.

36
00:01:24,433 --> 00:01:27,000
And we did not. Apply feature scaling to.

37
00:01:27,000 --> 00:01:28,933
The dependent variable. Vector y.

38
00:01:28,933 --> 00:01:30,000
But why was that?

39
00:01:30,000 --> 00:01:32,400
Why didn't we apply. Here feature scaling.

40
00:01:32,400 --> 00:01:34,333
To the dependent variable. Vector y.

41
00:01:34,333 --> 00:01:35,000
Well that's because.

42
00:01:35,000 --> 00:01:35,733
Remember.

43
00:01:35,733 --> 00:01:38,600
The data
set for our data preprocessing tools.

44
00:01:38,600 --> 00:01:40,933
Implementation. Was the data set
where the.

45
00:01:40,933 --> 00:01:44,066
Dependent. Variable was taking values
zero.

46
00:01:44,066 --> 00:01:45,033
Or one. Right.

47
00:01:45,033 --> 00:01:45,466
We can.

48
00:01:45,466 --> 00:01:47,166
Scroll up to have a. Look again.

49
00:01:47,166 --> 00:01:49,433
Remember these were the purchased.

50
00:01:49,433 --> 00:01:51,633
Decisions of this retail company.

51
00:01:51,633 --> 00:01:53,233
And that's the dependent variable.

52
00:01:53,233 --> 00:01:55,866
Taking the following. Values zero for the.

53
00:01:55,866 --> 00:01:57,300
Customer didn't buy the product.

54
00:01:57,300 --> 00:01:59,800
And one the customer bought the product.

55
00:01:59,800 --> 00:02:01,366
And therefore since it.

56
00:02:01,366 --> 00:02:04,666
Took value zero. Or one, then we did not.

57
00:02:04,666 --> 00:02:07,333
Have to apply feature scaling here
because.

58
00:02:07,333 --> 00:02:09,200
Exactly same as the dummy variables.

59
00:02:09,200 --> 00:02:10,466
Here, the values.

60
00:02:10,466 --> 00:02:15,566
Zero and one are already in the same range
as the one resulting from applying.

61
00:02:15,566 --> 00:02:18,300
Feature scaling onto the features.
All right.

62
00:02:18,300 --> 00:02:21,900
But now we are in a different situation.

63
00:02:21,900 --> 00:02:22,800
Indeed.

64
00:02:22,800 --> 00:02:26,100
This is our new data set position salaries

65
00:02:26,333 --> 00:02:29,000
where the features are indeed
the levels going.

66
00:02:29,000 --> 00:02:32,166
From 1 to 10, and the dependent variable.

67
00:02:32,200 --> 00:02:34,933
Taking values from 45,000 to.

68
00:02:34,933 --> 00:02:36,300
1 million.

69
00:02:36,300 --> 00:02:38,333
And so now I have a question for you.

70
00:02:38,333 --> 00:02:41,766
And after answering this question
you will know what to do in any.

71
00:02:41,766 --> 00:02:43,466
Feature scaling. Situation.

72
00:02:43,466 --> 00:02:46,466
So according to you do we have to apply
feature scaling to this.

73
00:02:46,500 --> 00:02:48,800
Dependent. Variable the salary.

74
00:02:48,800 --> 00:02:51,966
And the answer is well yes.

75
00:02:52,466 --> 00:02:53,833
I'm sure you guessed that right.

76
00:02:53,833 --> 00:02:56,400
Indeed,
we have to apply feature scaling because.

77
00:02:56,400 --> 00:02:58,233
Same we don't want this.

78
00:02:58,233 --> 00:03:00,600
Feature, you know,
which takes values much.

79
00:03:00,600 --> 00:03:01,566
Lower than the.

80
00:03:01,566 --> 00:03:06,833
Values of the dependent variable
to be neglected by the SVR model.

81
00:03:07,133 --> 00:03:09,233
And that even if there is not an.

82
00:03:09,233 --> 00:03:10,000
Explicit.

83
00:03:10,000 --> 00:03:13,666
Equation, you know, like in multiple
linear regression, this is.

84
00:03:13,666 --> 00:03:17,066
An explicit equation
because Y is explicitly.

85
00:03:17,100 --> 00:03:19,433
Resulting from a linear combination
of the.

86
00:03:19,433 --> 00:03:20,166
Features.

87
00:03:20,166 --> 00:03:22,533
And for our SVR model,
this is not the case.

88
00:03:22,533 --> 00:03:24,133
We have an implicit equation.

89
00:03:24,133 --> 00:03:26,966
But still through this implicit
equation, well,

90
00:03:26,966 --> 00:03:29,966
if the salary is way
higher than the features.

91
00:03:30,100 --> 00:03:32,066
And here this is absolutely the case.

92
00:03:32,066 --> 00:03:35,466
Well accordingly
the feature might be neglected.

93
00:03:35,466 --> 00:03:36,533
By the model.

94
00:03:36,533 --> 00:03:40,333
And actually I of course
try to build this SVR model

95
00:03:40,333 --> 00:03:42,233
without applying feature scaling.

96
00:03:42,233 --> 00:03:43,500
And you can check.

97
00:03:43,500 --> 00:03:45,700
That this absolutely doesn't work.

98
00:03:45,700 --> 00:03:49,666
Indeed, if we don't apply feature
scaling for our SVR.

99
00:03:49,666 --> 00:03:51,000
Implementation in training.

100
00:03:51,000 --> 00:03:53,966
On this data set, well,
you will see that the SVR.

101
00:03:53,966 --> 00:03:56,100
Model will not. Work at all.

102
00:03:56,100 --> 00:03:58,466
So we have to apply feature
scaling here. On.

103
00:03:58,466 --> 00:04:00,666
Both the feature where the values.

104
00:04:00,666 --> 00:04:03,666
Go from 1 to 10,
and the dependent variable

105
00:04:03,866 --> 00:04:07,033
taking values from 45,000 to 1 million.

106
00:04:07,566 --> 00:04:07,966
All right.

107
00:04:07,966 --> 00:04:09,366
And so now you know everything.

108
00:04:09,366 --> 00:04:10,166
About future scaling.

109
00:04:10,166 --> 00:04:12,433
You know what to do in any situation.

110
00:04:12,433 --> 00:04:13,200
You know that.

111
00:04:13,200 --> 00:04:15,233
You don't apply feature scaling to.

112
00:04:15,233 --> 00:04:18,200
Some dummy variables
resulting from one hot encoding.

113
00:04:18,200 --> 00:04:21,033
You know that when a dependent variable
takes binary.

114
00:04:21,033 --> 00:04:22,800
Values like. Zero and one, you.

115
00:04:22,800 --> 00:04:25,966
Don't have to apply feature scaling
either, because the values are already.

116
00:04:25,966 --> 00:04:27,166
In the right range.

117
00:04:27,166 --> 00:04:29,100
You also know that when the dependent
variable.

118
00:04:29,100 --> 00:04:32,100
Takes super high values
with respect to the other features,

119
00:04:32,266 --> 00:04:35,300
then you have to apply feature scaling
to put all the features and.

120
00:04:35,300 --> 00:04:37,533
The dependent variable in the same range.

121
00:04:37,533 --> 00:04:38,400
And finally.

122
00:04:38,400 --> 00:04:40,800
You also know. That
whenever you want to split.

123
00:04:40,800 --> 00:04:43,500
Your data set.
Into the training set and test it.

124
00:04:43,500 --> 00:04:46,500
Well, you have to apply feature scaling
after the split.

125
00:04:46,700 --> 00:04:47,300
All right.

126
00:04:47,300 --> 00:04:49,233
So now you know. Everything
about feature scaling.

127
00:04:49,233 --> 00:04:53,100
And by the end of this implementation
you will also know something

128
00:04:53,100 --> 00:04:54,833
very important
to do. With feature scaling.

129
00:04:54,833 --> 00:04:57,633
But you know, on the practical. Side
which will be the.

130
00:04:57,633 --> 00:04:59,533
Inverse transformation.

131
00:04:59,533 --> 00:05:02,600
Of feature scaling, you know,
when you scale your features or your.

132
00:05:02,600 --> 00:05:05,233
Dependent variable, at some. Point,
you know, to get the final.

133
00:05:05,233 --> 00:05:06,000
Prediction and to.

134
00:05:06,000 --> 00:05:09,000
Visualize the result,
you need to inverse that feature.

135
00:05:09,000 --> 00:05:11,100
Scaling,
you know, inverse that transformation.

136
00:05:11,100 --> 00:05:12,900
To go back to the original. Scale.

137
00:05:12,900 --> 00:05:15,100
And I. Will,
of course, teach you how to do it.

138
00:05:15,100 --> 00:05:16,133
So that we can not only.

139
00:05:16,133 --> 00:05:17,933
Get a very relevant.

140
00:05:17,933 --> 00:05:19,533
Prediction at the end in this.

141
00:05:19,533 --> 00:05:20,633
Step here, and.

142
00:05:20,633 --> 00:05:22,733
Also a super nice. Visualization.

143
00:05:22,733 --> 00:05:23,133
Where.

144
00:05:23,133 --> 00:05:25,033
Indeed we have the x.

145
00:05:25,033 --> 00:05:28,133
Axis and the y axis
back in their original scale.

146
00:05:28,133 --> 00:05:28,566
You know.

147
00:05:28,566 --> 00:05:31,233
These scales of the levels
going. From 1 to 10 and.

148
00:05:31,233 --> 00:05:32,366
The scale of the salaries.

149
00:05:32,366 --> 00:05:34,433
Going from 45,000 to 1.
