Hello.
Welcome back.
So let's see how to normalize.
I'm gonna make a copy of my last project over here
I'm going to call this number eight.
Muscle gain and then and then this is for normalization
double click over here and click to open must see our architecture again.
This is what we have we set to normalize.
We take the value what it's X or Y value we take the vector and then we we sort of divide each element
in the vector by the maximum element in the vector like this so you can sort of think of it as element
Y is division.
Okay so I'm gonna come over here and n lib gonna go to the c file over here and we're going to write
a function to do the.
So we are going to have a very simple function.
The function of start off by finding the maximum element in the vector.
And then once that is done it will go ahead to do the division.
There are other forms of normalization which we shall see later but let's take a step by step.
So come over here and see.
Void
normalize on a score data open close and then the first argument is a pointer to the input vector
like this.
The second argument is a pointer to the output vector
like this.
And the last argument is the length input and output vectors would have the same length.
So we can simply say early in full length over here open and close.
So like I said we start off by finding the max and you can post the video and try to accomplish this
on your own and then impose it.
And then we can do it together.
So find Max over here and what I'm gonna do is create a local variable in this function which I shall
call Max
and I'm going to assign this to input vector index 0.
The first element and we simply going to compare everything else to this first one.
So over here I'm gonna use a for loop by scene for
int i.
Because your eye is less than Len I plus plus.
And essentially we want to say if input vector index eye is created a mine is greater than Max over
here we can close then max E course input vector index I over here like this.
Once we've done this we can come out of a for loop and perform the normalization
divide each of them by Max.
And it's another for loop we're gonna use over here for int i.
Cause you
Oh yes less than Len
then I plus plus open and close and what we're gonna do is
output facto index.
Hi
equals in Perfecto index.
Hi
divided my marks like this
Okay we take the function prototype and put it in the interface file over here
and then I'm gonna put a semicolon here
and now we can go to our main function and try it out open window see over here and it's empty.
I'm just gonna clean everything from here.
Let's take a look at our architecture so that we can create some defined statement.
So what we have here is we have two features.
So two features mean in two inputs and we have three training examples.
Each row here represent a threat and a training example and each white column here represent a feature
type.
Right.
So I'm gonna come over here and see
zoom in a bit I'll a defined number of features
and we said we have two features.
I'm gonna put a comment here.
These are what are often known as the end values.
Now come over here defined
number of examples.
And we have three examples here.
In the example numbers often denote US m right.
Once that is done I'm gonna say I'm gonna create a factor here.
Open this up for will comment.
Hours of work out data
and we're going to have another one here.
Hours of rest data and I'll come over here and say double we can see hours of work our data is x 1 we'll
see double X one x number of examples the size is number of examples
and we've got a furnace over here and dust because the sea to work out hours of workout is to five and
one to always five hours and then one hour I'm gonna set over here to five.
One.
I hope you appreciate these that step by step approach we taken.
I'm sure it is perhaps too slow for some of you were already familiar with deep planning.
You can completely keep up.
You can.
Yeah go over Oh skip this.
This particular lesson or section if you find it a bit too mundane.
So I'm going to have this other one here known as
Double X too.
And this is going to be number of the sizes the same number of training examples but this has to do
with the hours of rest and when we start dealing with actual data we simply know we're not going to
have this let's say 3 3 numbers like this we would end up with less ten thousand numbers essentially.
Right.
That's a very small dataset.
This ridiculously small in machine learning language if you may.
Um so number of we say x2 his hours of rest.
Let's take a look at it.
So we said 8 5 8.
That's how much rest you got after your workout.
8 5 8
right.
And we are going to have a third one here.
Muscle gain does the output thus the y value.
So
once again data gonna come over here and see double
This is number of examples.
Just copy this.
Put it over here
and we said in the first day you gained 200 grams of muscles the next day you gain 90 grams in the third
day you gain 190 grams.
So we're going to design a neural network to help us know if you exercise for two hours and rest for
seven hours.
How many grams of muscles you'd gain essentially.
And um yeah sort of values are two hundred ninety and one ninety like this.
So I'm gonna create empty buffers here to store the normalized versions.
So a double I'll see underscore x 2 and this has the same size as x 2 and we're gonna normalize that
sort of value in here and in the same way we're gonna have this should be x 1.
This is x 1 proper underscore x 1 is the normalized version so we're gonna have an x 2 version and it's
the same thing and we're gonna have underscore y version because we're going to normalize y as well
right.
So once that is done we can come in here to our main function and call our function C normalize data.
The first is the input vector which is x 1.
The second argument is the output vector which is underscore x 1 0 x 1 prime if you want to call it
that.
It's just strange you cannot use the actual primes symbol encode and um the length is number of examples.
So we've normalized x1.
We can copy and paste the 4 x 2 as well as y
paste over here
x2 x2 pitched over here
y and then Y underscore Y.
Right.
So after this we would have normalized our features which are our inputs and then our outputs as well.
So I simply put a bit of print FS over here print f
row X1 data
and then put a new line here.
And then I'm simply going to use a for loop
Y is less than number of examples Hi plus plus.
OPEN AND CLOSE.
AND THEN WE SIMPLY GONNA DO print f
percentage F
and then X1 index.
I like this right and I'm going to copy and paste this.
Now see normalized X1
and over here we simply going to print the content of the underscore X1 buffer and I'm going to paste
this over here and see x2 data over here.
We simply going to print the content of the X2 buffer page this over here normalized x2
and we're going gonna print underscore x2 content over here and then page this over here and this becomes
raw why data go into print y values here and then normalized y data.
Gonna print the content of underscore y over here like this so we can build and see what it looks like.
I'm gonna click over here to Butte to build in
it's build successfully Queen to download onto my board by clicking over here and it's downloaded this
up in terror term and see what we have.
Click over here to open
I'm going to reset my board and this is where we have a c
um we forgot to put a number of new ID lines.
Sorry about that I just put some new lines between them to formatted better.
Let's see.
Print a new line here print another one here another one here.
Yeah this one here reviewed
download onto the port of Interior to
research my board right.
And this is what we have
we have the raw X1 values.
And when we normalized in this what we get.
Remember we said when we normalize we make it value fall between 0 and 1 and we did the same for x 2.
We did it for the y values as well.
Right.
So that's all there is for this lesson if you have any questions at all.
Just let me know and I'll see you later.
Have a nice day and I'm going to zoom the terror team in.
I'm going to find a way to increase the font size.
Sorry about the small font over here.
Yeah.
So to increase the font size here you can simply come over here.
I think it's somewhere here.
There is font somewhere set up font and then you click on font over here and we can select bigger font
and we can even change the type when I use 16 over here.
Let's see what we have right.
So this is going to be our new font size.
Yeah.
So sorry for the earlier lessons with smaller font and I'll see you later.