1
00:00:00,770 --> 00:00:01,140
Hello.

2
00:00:01,160 --> 00:00:01,730
Welcome back.

3
00:00:01,730 --> 00:00:05,450
In this lesson we agreed to write the function to perform the predictions.

4
00:00:05,450 --> 00:00:09,290
I'm going to save what we have and stuff from a new one.

5
00:00:09,290 --> 00:00:13,400
Call this number six right.

6
00:00:13,400 --> 00:00:15,610
So I'm going to just jump straight in.

7
00:00:15,680 --> 00:00:22,070
I'm going to come over here and create a new function called predict very simple and this function is

8
00:00:22,070 --> 00:00:25,970
going to take that weight the bias and then the inputs.

9
00:00:25,970 --> 00:00:36,740
So I said def it's gonna be predict and we passed W B and then X over here and what we want to do is

10
00:00:36,800 --> 00:00:38,740
we can predict with multiple inputs.

11
00:00:38,750 --> 00:00:42,290
We don't need to pass a single image we can pass a set of images.

12
00:00:42,380 --> 00:00:46,610
So we've got to check how many images we have to do that.

13
00:00:46,640 --> 00:00:51,240
I'm simply going to see a m course X door shape like we did earlier.

14
00:00:51,320 --> 00:00:52,580
Index 1.

15
00:00:52,790 --> 00:00:53,360
Okay.

16
00:00:53,360 --> 00:00:55,880
Once that is done we can.

17
00:00:57,320 --> 00:01:07,190
I'm gonna see why prediction of course and Peter zeros simply going to initialize this and pedo zeros

18
00:01:08,520 --> 00:01:10,190
and then the dimension

19
00:01:12,860 --> 00:01:19,380
one by M number of examples or number of input images.

20
00:01:19,590 --> 00:01:20,660
And once that's done

21
00:01:23,570 --> 00:01:34,640
we can simply we can simply compute for a cause like we did before sigmoid basically the m the weight

22
00:01:34,700 --> 00:01:40,310
and the biases of our model will be stored and we're going to take what we get from the land function

23
00:01:40,310 --> 00:01:46,790
remember the land is going to give us the weight W and then be the parameters we're going to use those

24
00:01:46,790 --> 00:01:51,860
we're going to pass those to this predictive function and if we pass those to this predictive function

25
00:01:51,860 --> 00:01:59,090
and we pass a y input we expect it to be able to distinguish cuts from non cuts essentially so we're

26
00:01:59,090 --> 00:02:05,090
going to go through the same method we have a single activation so overhand to predict function is going

27
00:02:05,090 --> 00:02:10,670
to be a single activation as well so I'm going to say N.P. dot

28
00:02:13,840 --> 00:02:27,670
then wait transpose come off X plus bias so it equals sigmoid P do it way to transpose bias Okay I have

29
00:02:27,670 --> 00:02:38,250
a typo here this is small W then X here is cut to X so that should be fine right.

30
00:02:38,260 --> 00:02:44,710
Once that is done we've got to convert the um the activations to zero once remember the activation is

31
00:02:44,710 --> 00:02:50,830
just it's just a floating point number we can end up with a value such a zero point eight zero point

32
00:02:50,830 --> 00:02:56,500
nine zero point two zero point one we're going to see if the values above zero point five it means it's

33
00:02:56,500 --> 00:02:59,890
a cut if it's below then it's not a cut.

34
00:03:00,040 --> 00:03:08,470
So we basically convert into the probability to a binary resource an accurate prediction 0 1.

35
00:03:08,680 --> 00:03:14,770
So I'm gonna come here and convert all of them at once using a loop for I in range

36
00:03:20,020 --> 00:03:29,590
and the range I want here is a dot shape plus one here which is the same as M we could have you know

37
00:03:30,730 --> 00:03:44,470
then I'll say if a 0 I if this is less than or equal to zero point five then why prediction where we

38
00:03:44,470 --> 00:03:48,230
gonna store results or a prediction.

39
00:03:48,230 --> 00:03:52,750
Zero I equals zero mean it's not a cut

40
00:03:55,340 --> 00:03:55,820
else

41
00:04:03,400 --> 00:04:04,390
why prediction

42
00:04:07,940 --> 00:04:08,550
zero.

43
00:04:08,560 --> 00:04:13,480
I of course won right.

44
00:04:13,520 --> 00:04:15,390
Meaning it is a cut.

45
00:04:15,490 --> 00:04:20,200
What we're gonna do now is return our y prediction.

46
00:04:20,200 --> 00:04:21,850
So I'm simply going to see a return

47
00:04:25,780 --> 00:04:27,670
y prediction here like this.

48
00:04:28,450 --> 00:04:34,390
Okay so now we have all the functions we need in the next lesson and we're going to put the function

49
00:04:34,390 --> 00:04:40,140
is to get us starting from the initialization through the propagation and then the land function we're

50
00:04:40,160 --> 00:04:43,710
gonna put those together and create a new function known as the model.

51
00:04:43,720 --> 00:04:49,540
And this is going to be the one that we call to train our model and get our results from it.

52
00:04:49,540 --> 00:04:49,840
Okay.

53
00:04:49,840 --> 00:04:54,010
So that's all there is for this lesson if you have any questions just let me know and I shall see you

54
00:04:54,010 --> 00:04:54,730
later.

55
00:04:54,790 --> 00:04:58,510
And if you're finding it useful just take some time off to leave a review.
