So let's write the function to demonstrate how to find error.
I'm gonna make a copy of the large project or rename this to find error
and I'm gonna open it
right.
So this our last project we simply need to go to a.
Simple neural network to see fall and implement the function.
Right.
And in the third indeed three school class we said we compute the error by an input multiply by weight
minus expected value.
So we're going to write a simple function that accept three argument it's gonna return the error.
So I'll see Britain double over here and the name of the function.
Find error.
And I'm going to call this simple cause we're gonna have another one.
Um the error we're dealing with currently we said it's simply expected value.
Um.
Right.
So what I'm trying to say is we can write two functions.
We can write a function that simply takes the Y had value which is the um the predicted value.
And then another function that takes the input and then the weight separately in order to compute the
Y heart from that.
So let's write both functions.
I'm gonna have one function on a simple and this one is gonna take just to argument the first argument
is Why had we just the predicted value.
And the second argument is why like this double why open close and we can simply return
power F and what we want to return is why hearts minus Y and raced to the power to the reason we get
in this is we've not included this C library so we've got to include Math thought h over here.
Right.
So this is our simple error function less find error or simple function let's write another function
and this function would allow us to parse the input and weight separately so that we can compute the
Y had the sources double find error
and the first argument we can see double input.
The second argument can be the weight
on the last argument can be the expected value which is the wife argue
we open and close and we simply want to return just like what we return here.
But this time we have to compute y how to ourself ourselves I should say.
So say input multiplied by weight in this gives us y hut and then we subtract expected value from this
and then everything in brackets we raced to the post to then we get the error.
So that's the same as this function here.
Right
let's see.
It says over here the practice this practice for this one.
This one is with this one.
This one is with this one
bright.
The reason we get in this is we want to bring the function.
Right.
Okay.
So let's expose these functions.
I'm gonna copy this.
Bring it to the dot.
Each file over here
put a semicolon here and the next one.
Okay the next one has a different number of arguments.
Easier.
Copy it or copy this pasted over here like this right.
So let's go to our main file and test it out.
So let's see
let's say we have some expected values here.
I'm going to create a vector on a rate hold them.
I'll say I'll just call them literally expected values.
And the length of expected values is equal to the output land.
And I can just see we expect.
So this is basically the y values.
These are the y values that we've sort of measured empirically.
It's an empirically um derived value that we want to train the one year in work with.
I know you understand this perhaps you've been talking about it is making it confusing.
So I'm simply going to say I mean that is or meaning this is the same US y values just for those of
you who could forget.
So over here we already predict in the we already have sad prediction.
So to compute side error we can simply do this so we can print outside error and we do it by find arrow
we call our function and then the first argument is the um the predicted the predicted output side we
pass this here and then the second argument is the expected output facade and the indices are the same.
So sad index here is the same.
You located in the same position in the expected values array.
I'm gonna paste this here and change it for sake
and over here we simply need to see sic
sic prediction index and sick prediction index and we do it once more for this one here active
copy this pasted over here then we can change the index
patient over here and paste over here like this and then control us to safe or click here to build
and click here to download onto the board once this is done I'm going to open territory and I'm going
to select my com port.
It's this one over here and I'm gonna press reset on my board and this is where we have we've got the
arrows and we've got the predicted values as well so this all the risk and I shall see you later.