Hello.
Welcome back.
So let's see how to create the single input single output neural network.
I'm going to create a new project by coming over here.
You you Vision project and
I'm going to create a new folder to hold this OR CALL THIS SINGLE IN SINGLE OUT
AND I'M GOING TO CALL THIS UM.
I'M GOING TO CALL A simple n in the project name is going to be simple.
And because what I want us to do is we should just copy the same project and rename the folder name
and continue from there rather than create a project from scratch each time.
So I'm gonna call it a project single and in a simple and I should say and I'm going to select my Board
estimates to f 4 1 1 V A T S this over here okay on The Simpsons or select call on the device startup.
Okay.
And um
I'm gonna create a number of files.
My target is the SDM that's 2 4
and I'll come over here or create or create up and I'll create another I'll say add group over here
just to make things look better or add another group and I renamed this to an end lip.
And remember this a very simple neural network and this will allow you to understand how um neural networks
are constructed from C language.
This will play your mind and you'll be able to picture neural networks in your mind and you'll be able
to draw them on a paper write code for them.
You have to go through this before you start using libraries.
It is better this way.
Right.
So what I'm going to do is I'm going to include I'm going to include a where were you at the library
to this project so that we can produce our resort.
We can be able to view it.
So we have this year I'm going to create a photo to store our House Call this you UT because I kept
this in D um D plan and forward.
So just bear with me.
When I take everything from this and put it here.
Right.
So this this is our You are the library.
Do you want to dot sea and Dot H.
Do you want to drive or I should say I'm gonna put it in a single in single out project right.
And
I'm gonna add another source group here.
I'll call those drivers.
And in here I'm going to bring our you up stuff
so we have our U S drivers here right.
So in up I'm going to create a women that see for each new item to group.
I'm gonna give this a name mean
and in n n lib I'm going to create a new file.
I'm going to call this simple road network very long name
a call a simple neural networks.
I'm gonna use a plural form.
Course we're going to be updating the file with different architectures.
Simple neural networks.
Okay I'm gonna copy this because the DOT h file is going to have the same name.
ATA new item select h over here.
Paste this over here and then add.
Right.
So let's take a look at a single input single output neural network again.
This is what it looks like.
This is what we saw in D.
Theoretical class.
We have an input.
The input interacts with the weight and produces an output input weight output and the interaction is
a simple multiplication input multiplied by weight equals output.
That is it very straightforward right.
So I'm going to do if not define defined here to prevent
to prevent multiple inclusions.
If and F underscore underscore
simple neural network
then define underscore underscore
simple neural network.
Then we end if.
Over here.
Right.
And um we are going to create a simple function.
I'm going to see this function is going to return the output so I'll see and fetch it to underscore
t presumably that's the data type we use in that it to on the score T and the function is going to be
single
single in single out and n and this function is going to take two parameters.
The first one is off and set it to underscore T as well and that's the input and the second one is into
third.
To underscore t this the weight right.
The reason we have the marks on the instead to underscore t is because we've not included the STV int
so to include STV into that h over here and it's disappeared.
Right.
So that's what we have.
So we can go to a wider C for a simple neural networks or C and include this dot each file though we've
just created s I'll say include
input neural networks dot h like this.
So once that is done we've got to implement this function.
I'll copy this and I'll pasted over here.
Open and close and the implementation is simple.
We saw that already.
And if you're a go class.
Simple multiplication.
Right.
And we returned a product so we can see the reason we have this is we forgot to clean this.
We can say a return
input would play by weight like this simple stuff and we can call this in the main function.
Right.
So we can go to our main file may not see is right here.
We can include our U S driver but by simply doing
include u auto H and then we can include our simple neural network
include simple neural networks that h like this once that is done we say int main
void open and close and we have well one over here open and close.
So let's see are your network again.
Okay we gave this example.
That's okay.
We have an array of temperature values and we want to predict it if the weight is minus 2 so let's implement
this exact same example.
I'm sure some of you can do this.
You don't even need to try it.
It's fine.
But for those of you who want to see how this is done you can continue watching this and we can just
declare our data here.
Presumably this is all data and this an array of temperature values
and the first value is twelve.
The second is twenty three fifty minus ten and sixteen is the last one I think.
Let's see.
Yeah.
It doesn't have to be the same as this.
These are just examples.
Okay.
And we said we have the weight the weight is minus 2
right.
So when we come here we can initialize so I use it.
So we call I use that too in its function
and wants to use such as initialize.
We can start running our prediction.
This is very simple but it's still a neural network.
We are explaining the concept of neural networks from the very simplest you know to block.
Um so we are so primitive over here and over here I can see the the first predicted value.
The first predictive value is from the first input which is this input here twelve the first predicted
value I can see it is
percentage D
R and then n okay.
And I can call our simple neural networks function.
It's called Single and single out.
Okay.
And the first argument is the input so a temperature index 0.
Because we see the first predicted value.
The second argument is the weight.
0 simply pass wait here.
Right.
So let's build this and see what we have.
We're going to click here to build okay.
No.
Click here to download onto the board of no set.
My debugger yet I'll click over here.
Debug SD link debugger settings flash download reset and run.
Okay.
And then.
Okay.
Click here to download right and I'm going to open to return.
Come over here select SD link.
I'm gonna reset my board and it says the first predicted value is 20 for the course weights minus two
multiplied by 12 is twenty four.
How about we predict the second or just copy and paste this
and then I can see a second over here.
Third over here and over here we simply need to change the array index.
So if we are doing this on huge data or if we automate this basically the whole thing is gonna be automated.
The array is going to be scanned through using one line of code in all of this is going to be done by
because I want you to understand.
That is why I'm sure you face prediction from array index 1 second prediction array index 2 just to
show that this is one training example.
This is another training example etc. right.
So that when you start seeing thousand training examples you understand.
This is how they work you know behind you know this is how they work in the background.
If you may.
Right.
So once this is done or click here to build and click here to download onto the board and we can see
terror term right.
This is from the previous one we can clear this clear screen.
Our research my board.
So we have first second and third right.
So there s I was simple single in a single output neural network and I'll see you in the next lesson.
Have a nice day.