1
00:00:00,990 --> 00:00:05,860
So let's write the function to demonstrate how to find error.

2
00:00:05,910 --> 00:00:12,260
I'm gonna make a copy of the large project or rename this to find error

3
00:00:24,710 --> 00:00:25,730
and I'm gonna open it

4
00:00:43,620 --> 00:00:44,240
right.

5
00:00:44,250 --> 00:00:47,560
So this our last project we simply need to go to a.

6
00:00:47,610 --> 00:00:52,600
Simple neural network to see fall and implement the function.

7
00:00:52,650 --> 00:00:53,100
Right.

8
00:00:53,130 --> 00:01:01,590
And in the third indeed three school class we said we compute the error by an input multiply by weight

9
00:01:01,680 --> 00:01:03,590
minus expected value.

10
00:01:03,690 --> 00:01:10,500
So we're going to write a simple function that accept three argument it's gonna return the error.

11
00:01:10,520 --> 00:01:16,130
So I'll see Britain double over here and the name of the function.

12
00:01:16,350 --> 00:01:17,820
Find error.

13
00:01:18,230 --> 00:01:24,230
And I'm going to call this simple cause we're gonna have another one.

14
00:01:24,740 --> 00:01:29,300
Um the error we're dealing with currently we said it's simply expected value.

15
00:01:29,980 --> 00:01:31,230
Um.

16
00:01:31,770 --> 00:01:32,520
Right.

17
00:01:32,550 --> 00:01:35,750
So what I'm trying to say is we can write two functions.

18
00:01:35,910 --> 00:01:42,170
We can write a function that simply takes the Y had value which is the um the predicted value.

19
00:01:43,110 --> 00:01:49,260
And then another function that takes the input and then the weight separately in order to compute the

20
00:01:49,590 --> 00:01:50,670
Y heart from that.

21
00:01:51,030 --> 00:01:52,720
So let's write both functions.

22
00:01:52,830 --> 00:01:58,950
I'm gonna have one function on a simple and this one is gonna take just to argument the first argument

23
00:01:58,950 --> 00:02:01,670
is Why had we just the predicted value.

24
00:02:01,680 --> 00:02:10,740
And the second argument is why like this double why open close and we can simply return

25
00:02:13,290 --> 00:02:23,610
power F and what we want to return is why hearts minus Y and raced to the power to the reason we get

26
00:02:23,610 --> 00:02:34,780
in this is we've not included this C library so we've got to include Math thought h over here.

27
00:02:36,180 --> 00:02:36,990
Right.

28
00:02:37,050 --> 00:02:43,800
So this is our simple error function less find error or simple function let's write another function

29
00:02:44,340 --> 00:02:50,310
and this function would allow us to parse the input and weight separately so that we can compute the

30
00:02:50,310 --> 00:02:55,680
Y had the sources double find error

31
00:02:59,010 --> 00:03:03,340
and the first argument we can see double input.

32
00:03:03,930 --> 00:03:06,180
The second argument can be the weight

33
00:03:09,310 --> 00:03:15,170
on the last argument can be the expected value which is the wife argue

34
00:03:19,650 --> 00:03:25,970
we open and close and we simply want to return just like what we return here.

35
00:03:26,130 --> 00:03:31,620
But this time we have to compute y how to ourself ourselves I should say.

36
00:03:31,620 --> 00:03:40,650
So say input multiplied by weight in this gives us y hut and then we subtract expected value from this

37
00:03:42,150 --> 00:03:49,060
and then everything in brackets we raced to the post to then we get the error.

38
00:03:49,740 --> 00:03:53,540
So that's the same as this function here.

39
00:03:54,130 --> 00:03:54,490
Right

40
00:04:09,820 --> 00:04:10,660
let's see.

41
00:04:10,680 --> 00:04:15,510
It says over here the practice this practice for this one.

42
00:04:15,510 --> 00:04:17,940
This one is with this one.

43
00:04:17,940 --> 00:04:19,140
This one is with this one

44
00:04:25,060 --> 00:04:25,470
bright.

45
00:04:25,470 --> 00:04:29,330
The reason we get in this is we want to bring the function.

46
00:04:29,700 --> 00:04:30,090
Right.

47
00:04:30,180 --> 00:04:30,570
Okay.

48
00:04:30,600 --> 00:04:32,930
So let's expose these functions.

49
00:04:32,940 --> 00:04:35,430
I'm gonna copy this.

50
00:04:35,430 --> 00:04:36,280
Bring it to the dot.

51
00:04:36,310 --> 00:04:37,290
Each file over here

52
00:04:40,190 --> 00:04:43,050
put a semicolon here and the next one.

53
00:04:43,410 --> 00:04:47,890
Okay the next one has a different number of arguments.

54
00:04:48,030 --> 00:04:48,370
Easier.

55
00:04:48,390 --> 00:04:56,900
Copy it or copy this pasted over here like this right.

56
00:04:56,940 --> 00:04:59,640
So let's go to our main file and test it out.

57
00:05:01,710 --> 00:05:02,790
So let's see

58
00:05:05,710 --> 00:05:10,140
let's say we have some expected values here.

59
00:05:10,420 --> 00:05:13,350
I'm going to create a vector on a rate hold them.

60
00:05:13,600 --> 00:05:18,670
I'll say I'll just call them literally expected values.

61
00:05:18,670 --> 00:05:24,900
And the length of expected values is equal to the output land.

62
00:05:25,630 --> 00:05:28,350
And I can just see we expect.

63
00:05:28,390 --> 00:05:30,970
So this is basically the y values.

64
00:05:30,970 --> 00:05:35,730
These are the y values that we've sort of measured empirically.

65
00:05:36,130 --> 00:05:43,450
It's an empirically um derived value that we want to train the one year in work with.

66
00:05:43,660 --> 00:05:48,540
I know you understand this perhaps you've been talking about it is making it confusing.

67
00:05:48,730 --> 00:05:56,590
So I'm simply going to say I mean that is or meaning this is the same US y values just for those of

68
00:05:56,590 --> 00:05:58,390
you who could forget.

69
00:05:58,390 --> 00:06:04,210
So over here we already predict in the we already have sad prediction.

70
00:06:04,210 --> 00:06:13,180
So to compute side error we can simply do this so we can print outside error and we do it by find arrow

71
00:06:13,210 --> 00:06:20,920
we call our function and then the first argument is the um the predicted the predicted output side we

72
00:06:20,920 --> 00:06:26,760
pass this here and then the second argument is the expected output facade and the indices are the same.

73
00:06:27,190 --> 00:06:30,660
So sad index here is the same.

74
00:06:30,730 --> 00:06:36,050
You located in the same position in the expected values array.

75
00:06:36,430 --> 00:06:39,820
I'm gonna paste this here and change it for sake

76
00:06:44,010 --> 00:06:46,920
and over here we simply need to see sic

77
00:06:50,600 --> 00:07:00,590
sic prediction index and sick prediction index and we do it once more for this one here active

78
00:07:03,630 --> 00:07:09,240
copy this pasted over here then we can change the index

79
00:07:12,170 --> 00:07:19,850
patient over here and paste over here like this and then control us to safe or click here to build

80
00:07:26,080 --> 00:07:35,080
and click here to download onto the board once this is done I'm going to open territory and I'm going

81
00:07:35,080 --> 00:07:36,750
to select my com port.

82
00:07:36,850 --> 00:07:43,330
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

83
00:07:43,390 --> 00:07:50,100
arrows and we've got the predicted values as well so this all the risk and I shall see you later.
