Hello, my friends.
All right.
Excellent.
We already did the essentials with data preprocessing.
By importing the libraries and importing the data set.
And now. I'd like us to particularly focus.
On this.
Feature scaling that we're about to do.
So I've already taught you feature scaling in the data preprocessing part.
You know, part one where indeed we implemented.
Together this feature scaling tool at the very. End.
You know, feature scaling where we.
Learned. How to scale with.
Standardization, the training set and the test set.
Separately. Okay. So that's what we did.
Now we are in a slightly.
Different situation.
In the sense that indeed. We.
Do not have. A split of the data set.
Between a training set and a test set.
And that, I remind, is because we want to leverage the maximum data
in order to learn the correlations between the business levels and the salaries.
So the first thing is we will actually apply exceptionally features killing.
On the. Whole matrix of features x.
Then the second important point and the second difference with.
What I taught you before.
In the same day.
Reprocessing tools. Implementation.
Is the fact.
That in this situation, we only.
Applied feature scaling to the features, right?
We only applied feature scaling.
To Xtrain and X.
Which are the features of respectively the training.
Set and to test it.
And we did not. Apply feature scaling to.
The dependent variable. Vector y.
But why was that?
Why didn't we apply. Here feature scaling.
To the dependent variable. Vector y.
Well that's because.
Remember.
The data set for our data preprocessing tools.
Implementation. Was the data set where the.
Dependent. Variable was taking values zero.
Or one. Right.
We can.
Scroll up to have a. Look again.
Remember these were the purchased.
Decisions of this retail company.
And that's the dependent variable.
Taking the following. Values zero for the.
Customer didn't buy the product.
And one the customer bought the product.
And therefore since it.
Took value zero. Or one, then we did not.
Have to apply feature scaling here because.
Exactly same as the dummy variables.
Here, the values.
Zero and one are already in the same range as the one resulting from applying.
Feature scaling onto the features. All right.
But now we are in a different situation.
Indeed.
This is our new data set position salaries
where the features are indeed the levels going.
From 1 to 10, and the dependent variable.
Taking values from 45,000 to.
1 million.
And so now I have a question for you.
And after answering this question you will know what to do in any.
Feature scaling. Situation.
So according to you do we have to apply feature scaling to this.
Dependent. Variable the salary.
And the answer is well yes.
I'm sure you guessed that right.
Indeed, we have to apply feature scaling because.
Same we don't want this.
Feature, you know, which takes values much.
Lower than the.
Values of the dependent variable to be neglected by the SVR model.
And that even if there is not an.
Explicit.
Equation, you know, like in multiple linear regression, this is.
An explicit equation because Y is explicitly.
Resulting from a linear combination of the.
Features.
And for our SVR model, this is not the case.
We have an implicit equation.
But still through this implicit equation, well,
if the salary is way higher than the features.
And here this is absolutely the case.
Well accordingly the feature might be neglected.
By the model.
And actually I of course try to build this SVR model
without applying feature scaling.
And you can check.
That this absolutely doesn't work.
Indeed, if we don't apply feature scaling for our SVR.
Implementation in training.
On this data set, well, you will see that the SVR.
Model will not. Work at all.
So we have to apply feature scaling here. On.
Both the feature where the values.
Go from 1 to 10, and the dependent variable
taking values from 45,000 to 1 million.
All right.
And so now you know everything.
About future scaling.
You know what to do in any situation.
You know that.
You don't apply feature scaling to.
Some dummy variables resulting from one hot encoding.
You know that when a dependent variable takes binary.
Values like. Zero and one, you.
Don't have to apply feature scaling either, because the values are already.
In the right range.
You also know that when the dependent variable.
Takes super high values with respect to the other features,
then you have to apply feature scaling to put all the features and.
The dependent variable in the same range.
And finally.
You also know. That whenever you want to split.
Your data set. Into the training set and test it.
Well, you have to apply feature scaling after the split.
All right.
So now you know. Everything about feature scaling.
And by the end of this implementation you will also know something
very important to do. With feature scaling.
But you know, on the practical. Side which will be the.
Inverse transformation.
Of feature scaling, you know, when you scale your features or your.
Dependent variable, at some. Point, you know, to get the final.
Prediction and to.
Visualize the result, you need to inverse that feature.
Scaling, you know, inverse that transformation.
To go back to the original. Scale.
And I. Will, of course, teach you how to do it.
So that we can not only.
Get a very relevant.
Prediction at the end in this.
Step here, and.
Also a super nice. Visualization.
Where.
Indeed we have the x.
Axis and the y axis back in their original scale.
You know.
These scales of the levels going. From 1 to 10 and.
The scale of the salaries.
Going from 45,000 to 1.