1
00:00:00,570 --> 00:00:00,940
Hello.

2
00:00:00,960 --> 00:00:01,790
Welcome back.

3
00:00:01,810 --> 00:00:06,840
In this lesson we're going to test a wall to lay a new network model that we created.

4
00:00:06,840 --> 00:00:10,890
So I'm going to call the function does the name of the function to layout and then model.

5
00:00:10,890 --> 00:00:12,030
Copy this.

6
00:00:12,030 --> 00:00:17,100
Come over here pasted over here and then.

7
00:00:17,530 --> 00:00:22,100
This function is going to return a dictionary called parameters.

8
00:00:22,110 --> 00:00:27,180
And this is going to you know give us the parameters that we use for prediction.

9
00:00:27,180 --> 00:00:28,680
So I'm gonna see parameters

10
00:00:31,270 --> 00:00:37,370
equals this I'm going to store the return into another dictionary which we shall call parameters now.

11
00:00:37,450 --> 00:00:44,740
This function takes it takes the training example let's see the function takes x which is that training

12
00:00:44,800 --> 00:00:46,890
X Y which is the training y.

13
00:00:46,930 --> 00:00:51,920
They are dimensions and then um yeah.

14
00:00:51,970 --> 00:00:56,110
Then the Delenn and great as we see over here the number of iterations.

15
00:00:56,350 --> 00:01:00,990
So let's grab our screen X from here.

16
00:01:01,340 --> 00:01:02,880
Have a typo here I would just fix this.

17
00:01:02,880 --> 00:01:05,000
No I'm going to copy train x.

18
00:01:05,750 --> 00:01:06,880
I'm gonna put it over here

19
00:01:11,160 --> 00:01:12,150
and then train y

20
00:01:15,240 --> 00:01:17,000
we should have train y somewhere

21
00:01:23,330 --> 00:01:26,030
let's see.

22
00:01:27,200 --> 00:01:27,610
Right.

23
00:01:27,680 --> 00:01:30,720
Train y train Y from here.

24
00:01:30,920 --> 00:01:33,160
P sit over here.

25
00:01:33,320 --> 00:01:37,380
And then lay dimensions.

26
00:01:37,700 --> 00:01:40,050
We already have layout dimensions.

27
00:01:40,320 --> 00:01:44,500
Um we can just create over here.

28
00:01:44,540 --> 00:01:53,200
I'm gonna see this then it's got dimensions because we're going to pass an X which we created earlier

29
00:01:53,300 --> 00:01:58,600
and H and then and Y we have these variables here

30
00:02:01,450 --> 00:02:02,470
right.

31
00:02:02,570 --> 00:02:03,920
A number of iterations.

32
00:02:03,980 --> 00:02:09,950
We can set a number of iterations.

33
00:02:09,950 --> 00:02:19,580
When I come off I hear when I see a number on this call iterations I can say this to let's say three

34
00:02:19,580 --> 00:02:23,420
thousand or perhaps two thousand five hundred.

35
00:02:23,570 --> 00:02:26,240
Okay let's start with this and see the performance.

36
00:02:27,680 --> 00:02:36,210
Okay let's see.

37
00:02:37,110 --> 00:02:37,420
Okay.

38
00:02:37,510 --> 00:02:42,440
So after after training we're going to have our parameters stored in this dictionary.

39
00:02:43,180 --> 00:02:48,280
Um let's see our predictive function that we wrote.

40
00:02:48,280 --> 00:02:50,770
I'm gonna come to our library.

41
00:02:50,770 --> 00:02:56,170
We have a predictive function okay to predict function takes x y and z parameters.

42
00:02:56,170 --> 00:02:56,470
Okay.

43
00:02:56,500 --> 00:03:04,860
So we can predict once we've trained I'm gonna come over here and call it a predictive function I say

44
00:03:04,870 --> 00:03:13,380
predict and then what are we going to predict with let's try predicting what we train in values.

45
00:03:13,400 --> 00:03:14,560
So I say train x.

46
00:03:14,650 --> 00:03:18,730
We compare that to the test values train X train y

47
00:03:22,790 --> 00:03:27,620
and then the last argument is parameters

48
00:03:30,740 --> 00:03:33,910
and we're going to store this in a variable which we shall call

49
00:03:38,450 --> 00:03:47,750
train prediction meaning prediction from the training set and then we are going to predict again we're

50
00:03:47,750 --> 00:03:50,060
going to create another variable called Test prediction

51
00:03:52,700 --> 00:03:56,050
which is going to hold prediction from the test set.

52
00:03:56,060 --> 00:03:59,210
And over here we are going to pass test x

53
00:04:02,800 --> 00:04:05,020
test y.

54
00:04:05,020 --> 00:04:11,280
And of course parameters copy paste over here like this.

55
00:04:12,330 --> 00:04:16,740
Okay.

56
00:04:17,510 --> 00:04:19,560
Um yeah.

57
00:04:19,720 --> 00:04:22,810
I think we can print

58
00:04:31,150 --> 00:04:31,930
the train

59
00:04:35,470 --> 00:04:46,810
conviction is a plus here SDR then a print trend prediction trophy to pic to paste over here and then

60
00:04:46,860 --> 00:04:58,730
I'm going to print the test prediction the test prediction is plus SDR.

61
00:04:59,660 --> 00:05:04,530
When a print the test prediction copy paste over here.

62
00:05:05,090 --> 00:05:05,540
Right.

63
00:05:06,230 --> 00:05:10,480
So we can build and see what we have.

64
00:05:10,550 --> 00:05:14,830
Let's see how many arrows we get control as to save.

65
00:05:14,990 --> 00:05:16,700
Click over here run module

66
00:05:20,040 --> 00:05:21,210
number of iterations.

67
00:05:21,240 --> 00:05:22,970
Okay so there's a typo here.

68
00:05:22,980 --> 00:05:25,810
Line fifty seven.

69
00:05:31,940 --> 00:05:34,420
This should be on a control is to save

70
00:05:39,610 --> 00:05:45,470
and then click here to run more to.

71
00:05:45,870 --> 00:05:49,200
Not a typo like sixty one.

72
00:05:49,310 --> 00:05:57,230
Sorry but the compute cost the best way to find typos is to run the module.

73
00:05:59,120 --> 00:06:01,430
Okay let's run again.

74
00:06:04,660 --> 00:06:06,460
See name is not defined.

75
00:06:06,460 --> 00:06:07,690
Line 67.

76
00:06:09,970 --> 00:06:13,660
Yeah I'm sure we meant to write up to Z.

77
00:06:13,660 --> 00:06:19,720
This one is in a war plan in library line 67.

78
00:06:25,690 --> 00:06:28,030
Line 67 should be up here somewhere.

79
00:06:33,020 --> 00:06:34,490
Come to see here.

80
00:06:34,590 --> 00:06:35,330
Contra s

81
00:06:42,670 --> 00:06:43,780
gonna run again.

82
00:06:43,810 --> 00:06:49,750
Run module T W not defined line 67 again.

83
00:06:58,830 --> 00:07:00,240
Line 67.

84
00:07:05,050 --> 00:07:08,590
And this time is in our actual script.

85
00:07:08,950 --> 00:07:12,860
Not a library line sixty seven sixty seven.

86
00:07:19,960 --> 00:07:20,290
Okay.

87
00:07:20,380 --> 00:07:24,380
They should be kept to top w you control S.

88
00:07:28,390 --> 00:07:37,780
Click here to run the module DP to line seventy right.

89
00:07:37,920 --> 00:07:43,590
So DP 2 is not defined is because over here I wrote DP 1 instead of TB 2.

90
00:07:43,590 --> 00:07:44,500
Just bear with me.

91
00:07:45,240 --> 00:07:48,940
So let's see do we have any arrows anymore arrows.

92
00:07:49,890 --> 00:07:54,030
Okay DP 1 over here is in our library.

93
00:07:54,030 --> 00:07:57,480
Line ninety five in the library.

94
00:08:01,350 --> 00:08:07,800
So um perhaps you can see reduce this a bit.

95
00:08:07,980 --> 00:08:10,820
So we have an arrow in the library.

96
00:08:10,980 --> 00:08:15,610
It says line 95 of the actual script to lay in.

97
00:08:15,700 --> 00:08:17,750
Okay let's see.

98
00:08:17,790 --> 00:08:18,840
Line 95.

99
00:08:18,840 --> 00:08:20,950
It says What does it say.

100
00:08:20,940 --> 00:08:26,010
D W one key arrow T.W. one y ninety five.

101
00:08:26,010 --> 00:08:26,670
Key arrow

102
00:08:35,200 --> 00:08:37,490
Kristen K.

103
00:08:43,970 --> 00:08:45,330
huh.

104
00:08:45,640 --> 00:08:48,500
SC to predict this you predict.

105
00:08:48,500 --> 00:08:49,040
Function

106
00:08:57,130 --> 00:09:04,830
right the arrows from this over here you know where to lay a neural network function that D.W. won here.

107
00:09:04,870 --> 00:09:08,640
I used a small w so o change you took up to a W.

108
00:09:08,770 --> 00:09:16,190
Let's see if we have any further arrows country s to save run module.

109
00:09:16,880 --> 00:09:19,120
Cost is not defined.

110
00:09:20,530 --> 00:09:21,150
Let's see.

111
00:09:21,970 --> 00:09:22,600
Yeah.

112
00:09:22,600 --> 00:09:25,770
This has to be a plural costs.

113
00:09:25,780 --> 00:09:26,560
I suspect.

114
00:09:26,720 --> 00:09:27,610
Let's see hmm.

115
00:09:29,920 --> 00:09:32,530
Okay so is talking about a single cost.

116
00:09:32,560 --> 00:09:37,130
When we completed a cost here this there there's a typo here with double C or clean.

117
00:09:37,140 --> 00:09:45,480
This contract is to save the C run more to follow.

118
00:09:45,640 --> 00:09:46,610
No more arrows.

119
00:09:46,630 --> 00:09:49,800
Now we're in training mode.

120
00:09:49,840 --> 00:09:56,020
Okay I can see the arrow is reducing.

121
00:09:56,020 --> 00:09:57,670
We've got to wait for a while.

122
00:09:57,700 --> 00:10:05,020
I'm gonna minimize this.

123
00:10:06,050 --> 00:10:06,580
Okay.

124
00:10:16,320 --> 00:10:23,670
And like we stated in our function we print in the um did cost every one hundred it iteration.

125
00:10:23,670 --> 00:10:29,970
That is why we start from zero then one hundred and two hundred then 300 400.

126
00:10:29,970 --> 00:10:34,990
And we said we wanted I think two thousand five hundred iterations.

127
00:10:35,130 --> 00:10:40,290
We trained in forty one thousand five hundred iterations and now the error has drastically reduce this

128
00:10:40,370 --> 00:10:42,990
graph for the error reduction.

129
00:10:43,440 --> 00:10:48,270
We started over here to a point seven and then we came.

130
00:10:48,650 --> 00:10:51,800
We call here okay.

131
00:10:51,890 --> 00:10:59,880
So when I close this graph um it's printed in predictions but it's our accuracy is the accuracy for

132
00:10:59,880 --> 00:11:03,960
the um for the training set.

133
00:11:05,630 --> 00:11:11,640
We test that the prediction on the training set the accuracy we go to zero point zero point nine nine

134
00:11:12,720 --> 00:11:17,760
for the test set we go seventy two percent we've got nineteen ninety nine percent for the training set

135
00:11:18,270 --> 00:11:22,030
and then seventy two percent for the test set.

136
00:11:22,280 --> 00:11:27,840
Um and I think this is higher than what we saw in our uh uh what other model the logistic regression

137
00:11:27,850 --> 00:11:35,430
what I think we had it at 69 or 70 percent but anyway this the accuracy we got we can actually um test

138
00:11:35,430 --> 00:11:36,570
with our own image.

139
00:11:36,990 --> 00:11:44,520
So let's do the um print in the train prediction and the test prediction I think is rather difficult

140
00:11:44,700 --> 00:11:46,130
to make meaning of this.

141
00:11:46,140 --> 00:11:52,050
So what we're going to do is create a function that would show us the images that were missed predicted

142
00:11:52,140 --> 00:11:56,950
that you made this word a wrong prediction or could as well as test with our own image.

143
00:11:57,180 --> 00:12:02,000
Okay so I'm going to close this now and then I'm

144
00:12:06,770 --> 00:12:10,600
gonna clean this up now.

145
00:12:10,650 --> 00:12:18,850
I'm going to create a function to show us the images with which we did and uh perform well.

146
00:12:20,100 --> 00:12:24,540
Okay I'm going to write a function here which I shall call print wrong predictions

147
00:12:37,240 --> 00:12:49,210
and we shall use the classes from our data set and then X Y and then the probabilities P and

148
00:12:53,200 --> 00:13:01,870
so we have the classes our images our training X the labels and the predictions.

149
00:13:02,380 --> 00:13:08,920
Okay I'm going to create a variable here a no C E course P plus why not come here and see

150
00:13:13,880 --> 00:13:14,780
mislabeled

151
00:13:18,090 --> 00:13:22,380
indices because non pi dot as array

152
00:13:25,940 --> 00:13:27,600
and p dot were

153
00:13:32,940 --> 00:13:33,950
a course won.

154
00:13:34,370 --> 00:13:42,470
Okay so then I'm gonna say I'm gonna set the default size of the plot.

155
00:13:42,470 --> 00:13:47,570
We're going to put the images of the wrong predictions as well and see which images we had difficulty

156
00:13:47,570 --> 00:13:48,190
with.

157
00:13:48,200 --> 00:13:55,200
So C P O T R C firearms 10 0 c

158
00:13:57,700 --> 00:14:00,430
figure that fixed size

159
00:14:06,600 --> 00:14:12,180
equals simply C 30 30

160
00:14:17,000 --> 00:14:30,260
and then once that is done I'm going to come down here and see no more images because Len Len of mislabeled

161
00:14:30,260 --> 00:14:30,920
indices

162
00:14:35,360 --> 00:14:43,700
index you like this then I'm gonna use a loop come down here for I in range

163
00:14:50,510 --> 00:14:51,410
of images.

164
00:14:55,120 --> 00:14:55,820
I'll see

165
00:14:59,850 --> 00:15:03,710
index because it's labeled indices

166
00:15:08,210 --> 00:15:11,980
one index I over here.

167
00:15:12,380 --> 00:15:15,090
Now I'm going to plot them.

168
00:15:16,140 --> 00:15:19,100
I see a penalty let's not subplot

169
00:15:22,510 --> 00:15:30,050
two comma number of images just over here.

170
00:15:30,130 --> 00:15:37,660
Plus one and then I'm going to use I am sure by saying P L T dot I am show

171
00:15:40,450 --> 00:15:40,870
X

172
00:15:43,890 --> 00:15:44,890
comma index

173
00:15:48,040 --> 00:15:49,450
then reshape this.

174
00:15:50,320 --> 00:15:53,690
Remember our image is sixty four by sixty four by three.

175
00:15:55,480 --> 00:15:57,130
So I'll do it or to reshape

176
00:16:05,220 --> 00:16:11,330
and then interpolate say interpolation of course.

177
00:16:11,480 --> 00:16:20,830
Nearest.

178
00:16:21,360 --> 00:16:22,560
Then once that's done

179
00:16:25,460 --> 00:16:28,930
I'll see I just said a Title VI here.

180
00:16:28,960 --> 00:16:31,180
Peyote title.

181
00:16:32,100 --> 00:16:33,500
Call this protection

182
00:16:39,190 --> 00:16:42,770
plus classes.

183
00:16:42,880 --> 00:16:50,010
Remember we get classes from our data set when we load data we load a classes as well.

184
00:16:50,070 --> 00:16:52,570
Okay.

185
00:16:53,050 --> 00:17:07,390
Plus classes index sheet into typecast into VI here and then P and then zero comma index.

186
00:17:08,370 --> 00:17:09,670
And then dot

187
00:17:13,400 --> 00:17:17,380
we decode this to UTF 8

188
00:17:23,490 --> 00:17:24,090
plus

189
00:17:29,070 --> 00:17:30,510
append a new line here.

190
00:17:46,940 --> 00:17:48,860
Then kind of corrupt the Y

191
00:17:55,030 --> 00:17:55,840
classes

192
00:17:59,020 --> 00:18:00,830
y index 0.

193
00:18:00,940 --> 00:18:01,540
Index

194
00:18:05,430 --> 00:18:06,700
then decode

195
00:18:11,740 --> 00:18:13,070
to UTF 8

196
00:18:18,130 --> 00:18:20,220
right.

197
00:18:20,570 --> 00:18:24,010
So let's check if we have some typos.

198
00:18:24,410 --> 00:18:33,830
They should be able to call this function we should be able to sort of display to the wrong predictions

199
00:18:33,830 --> 00:18:36,240
that we made.

200
00:18:36,260 --> 00:18:40,730
So now we can call our function print wrong predictions.

201
00:18:40,790 --> 00:18:45,070
Call this over here and I'm gonna pass classes.

202
00:18:45,290 --> 00:18:47,840
The classes we got from our dataset

203
00:18:52,890 --> 00:18:55,920
and then I'm gonna pass a test.

204
00:18:56,120 --> 00:18:58,450
Um our ex is gonna be the test.

205
00:18:59,150 --> 00:19:03,550
X or Y is gonna be the test.

206
00:19:03,560 --> 00:19:03,890
Y

207
00:19:08,110 --> 00:19:10,610
o predictions is going to be these predictions.

208
00:19:10,660 --> 00:19:18,670
We go from predicting the test which is over here test predictions.

209
00:19:19,120 --> 00:19:20,560
Paste this over here.

210
00:19:21,430 --> 00:19:21,990
Okay.

211
00:19:22,010 --> 00:19:26,170
Once they down our Popeil Tito show over here.

212
00:19:26,170 --> 00:19:34,330
Right let's build and see what we have or just verify this function has an end.

213
00:19:34,750 --> 00:19:35,900
Okay.

214
00:19:36,460 --> 00:19:36,820
Right.

215
00:19:36,850 --> 00:19:41,780
I'm gonna click over here to run the module invalid.

216
00:19:42,130 --> 00:19:44,620
Yeah of course there should be a comb my hair

217
00:19:51,540 --> 00:19:53,040
click over here.

218
00:19:53,040 --> 00:19:55,500
Run module.

219
00:19:55,500 --> 00:19:55,840
Okay.

220
00:19:55,860 --> 00:19:57,010
It s training.

221
00:20:01,000 --> 00:20:01,480
Right.

222
00:20:01,510 --> 00:20:07,780
So this the graph close this and we have an arrow test.

223
00:20:07,780 --> 00:20:08,810
X is not defined.

224
00:20:09,550 --> 00:20:10,580
Goodness.

225
00:20:10,660 --> 00:20:11,850
Come all the way down here.

226
00:20:11,890 --> 00:20:13,810
And then we find the arrow.

227
00:20:13,810 --> 00:20:18,840
Okay test X X because this should be a small x not a capital X..

228
00:20:19,000 --> 00:20:20,070
I'm gonna run this again.

229
00:20:23,800 --> 00:20:24,300
Okay.

230
00:20:24,350 --> 00:20:24,850
Straining

231
00:20:30,830 --> 00:20:32,120
Okay so growth

232
00:20:38,410 --> 00:20:42,950
okay we still have some arrows actually.

233
00:20:42,970 --> 00:20:47,660
Image object personal property code interpolation.

234
00:20:47,900 --> 00:20:54,310
I may have may have missed um mis spelled the word.

235
00:20:55,920 --> 00:20:58,030
Yep I think.

236
00:20:58,870 --> 00:21:00,660
Okay yeah.

237
00:21:00,880 --> 00:21:04,780
There's gonna be a lot of error fixing when we are doing life programming.

238
00:21:04,780 --> 00:21:07,190
So the word should be interpolation.

239
00:21:07,440 --> 00:21:13,520
And the one that I'm gonna actually do over here is turn off the axes.

240
00:21:14,570 --> 00:21:22,330
I do PR T dot axes and then I'm gonna see off like this.

241
00:21:22,330 --> 00:21:24,210
Okay interpolation.

242
00:21:24,610 --> 00:21:25,860
Okay.

243
00:21:26,050 --> 00:21:26,630
Right.

244
00:21:26,740 --> 00:21:27,550
I'm gonna run again

245
00:21:38,480 --> 00:21:40,860
this graph.

246
00:21:41,450 --> 00:21:44,480
Okay so this is where we made our mistake.

247
00:21:46,610 --> 00:21:47,180
Um

248
00:21:52,460 --> 00:21:52,810
okay.

249
00:21:53,030 --> 00:21:54,980
So in a way you see a cut.

250
00:21:55,040 --> 00:21:57,460
It s means we predict like we predicted.

251
00:21:57,500 --> 00:21:58,540
No cut.

252
00:21:58,670 --> 00:22:04,280
So we weren't able to predict this correctly and we missed 2k butterfly for a cut.

253
00:22:04,370 --> 00:22:05,150
We saw a cut.

254
00:22:05,180 --> 00:22:06,890
We said it wasn't a cut.

255
00:22:06,890 --> 00:22:08,930
We mistook this for a cut as well.

256
00:22:09,680 --> 00:22:10,880
We couldn't predict this.

257
00:22:10,880 --> 00:22:12,420
We mistook this for a cut.

258
00:22:12,470 --> 00:22:15,440
We couldn't predict the number of cuts.

259
00:22:15,550 --> 00:22:16,750
Let's see.

260
00:22:18,020 --> 00:22:18,680
Um

261
00:22:28,630 --> 00:22:31,180
okay so that text is not very clear.

262
00:22:31,210 --> 00:22:36,510
I'm trying to expand this to get as player as possible.

263
00:22:36,520 --> 00:22:39,330
I'm going to increase the size of this.

264
00:22:39,370 --> 00:22:44,500
Not that it matters but I'm going to increase the size of the images so that we can't see where we made

265
00:22:44,500 --> 00:22:46,910
our mistakes.

266
00:22:46,930 --> 00:22:53,950
I'm just gonna come here and set them to Fifty and fifty control as I'm going to train again.

267
00:22:58,950 --> 00:23:00,480
So this is our graph.

268
00:23:05,350 --> 00:23:08,980
Okay right.

269
00:23:09,010 --> 00:23:10,200
So anyway yeah.

270
00:23:10,270 --> 00:23:13,060
Wherever you see a cut we made a mistake there.

271
00:23:13,420 --> 00:23:19,960
We predicted it as non cut and wherever you see something that is a cut we mistook that for a cut.

272
00:23:19,960 --> 00:23:23,540
So yeah there's the performance.

273
00:23:23,650 --> 00:23:26,000
We have 72 percent accuracy.

274
00:23:26,290 --> 00:23:31,030
Later on we shall see how to perform the same task with other neural networks.

275
00:23:31,030 --> 00:23:37,120
We shall try this which convolution our neural network and we'll realize that performs better than this

276
00:23:37,420 --> 00:23:41,520
and given a small amount of you know data said we've trained I am not alone.

277
00:23:41,520 --> 00:23:46,910
72 percent is actually a very good um a very good accuracy.

278
00:23:47,060 --> 00:23:47,980
Anyway let's move on.

279
00:23:48,010 --> 00:23:50,140
Let's try with our own image.

280
00:23:50,560 --> 00:23:54,710
Um I'm going to um load in an image like we did before.

281
00:23:55,870 --> 00:23:57,740
Um okay.

282
00:23:57,850 --> 00:24:09,000
I'm going to comment about this the bit that shows I'll put a comment here for you on comment to show

283
00:24:12,340 --> 00:24:13,480
wrong predictions

284
00:24:16,010 --> 00:24:16,800
right.

285
00:24:16,840 --> 00:24:27,070
So now I'm going to load an image I'm gonna see my image my image because we have an image you know

286
00:24:27,070 --> 00:24:27,210
what.

287
00:24:27,210 --> 00:24:34,360
You may just fold I know Scott's image or we just rename one to cut image my image of course cut the

288
00:24:34,360 --> 00:24:36,130
JPEG and um

289
00:24:38,950 --> 00:24:39,400
I'm gonna

290
00:24:43,210 --> 00:24:54,250
I'm gonna come over here and see phoneme f name because I just create some line here f name equals images

291
00:24:54,310 --> 00:25:00,010
folder slash plus my image

292
00:25:03,460 --> 00:25:21,250
patient over here and then I'm gonna see image cause and Pitot Ray then we're going to do indeed that

293
00:25:21,370 --> 00:25:25,750
image that I read.

294
00:25:25,750 --> 00:25:36,100
Actually I'm going to take a look at the D python library or the python module we use for you know processing

295
00:25:36,100 --> 00:25:42,280
the image in our cut or no cut lesson because I remember one of the um the modules who were using one

296
00:25:42,280 --> 00:25:48,140
of the libraries was deprecated and we had issues with that so I'm going to see what we did in there.

297
00:25:49,720 --> 00:25:53,590
So this is our cut on not projects I'm going to check.

298
00:25:53,590 --> 00:25:55,240
No h over here

299
00:25:58,230 --> 00:25:59,070
over here.

300
00:25:59,070 --> 00:25:59,480
Okay.

301
00:25:59,520 --> 00:26:01,000
So this is how we did a prediction.

302
00:26:00,990 --> 00:26:03,560
I'm simply going to quote uh copy this.

303
00:26:04,190 --> 00:26:08,400
I think is almost the same as Yeah.

304
00:26:09,270 --> 00:26:12,480
I'll paste this here and this should do the prediction for us.

305
00:26:12,510 --> 00:26:19,040
Over here we are checking image number six in our images folder and then we predict.

306
00:26:20,250 --> 00:26:20,910
Let's.

307
00:26:31,550 --> 00:26:32,060
K

308
00:26:37,970 --> 00:26:38,880
um

309
00:26:41,730 --> 00:26:44,390
let's see the image.

310
00:26:44,590 --> 00:26:45,950
How about that.

311
00:26:46,340 --> 00:26:47,800
We said he made six.

312
00:26:47,800 --> 00:26:53,910
We see estimate six image six is this but okay.

313
00:26:54,190 --> 00:26:57,500
Image six is this but over here.

314
00:26:58,090 --> 00:26:59,140
No images for the

315
00:27:03,180 --> 00:27:04,020
This over here.

316
00:27:04,050 --> 00:27:05,640
I'm gonna change it to.

317
00:27:06,570 --> 00:27:10,770
I think I'll predict function.

318
00:27:10,840 --> 00:27:15,130
You should be w and this should be the W has to be capital.

319
00:27:15,150 --> 00:27:16,560
I suspect.

320
00:27:16,560 --> 00:27:21,300
I don't know what are we made a small w in our previous cuts or not projects.

321
00:27:21,400 --> 00:27:25,980
But I've changed from small W to capital W here.

322
00:27:26,040 --> 00:27:27,540
Now let's run and see what we have.

323
00:27:27,570 --> 00:27:29,760
I'm gonna click here to run the module

324
00:27:47,780 --> 00:27:50,700
it's training.

325
00:27:50,700 --> 00:27:52,320
Okay.

326
00:27:52,950 --> 00:28:00,700
And the image is not defined okay because we're not included in the image if not imported it yet.

327
00:28:00,700 --> 00:28:06,460
So we've got a imports that goodness from all over the place today.

328
00:28:06,720 --> 00:28:10,290
So I'm gonna say from side by

329
00:28:13,730 --> 00:28:16,430
import and image.

330
00:28:18,170 --> 00:28:27,630
Okay let's run again.

331
00:28:28,040 --> 00:28:28,390
Okay

332
00:28:35,600 --> 00:28:38,460
to name D is not defined.

333
00:28:39,350 --> 00:28:54,220
Okay let's see this image prediction predicted T W DP says the name D no defined mm mm mm mm mm mm mm

334
00:28:54,250 --> 00:28:54,810
mm mm mm mm.

335
00:28:55,290 --> 00:28:58,720
Let's see what our predict function looks like.

336
00:28:58,720 --> 00:29:00,300
Um you've got to forgive me.

337
00:29:00,360 --> 00:29:00,620
Yeah.

338
00:29:01,380 --> 00:29:12,080
Um perhaps to predict function we wrote for this new lesson is different from the one we used in a you

339
00:29:12,090 --> 00:29:13,340
know other lesson.

340
00:29:14,840 --> 00:29:19,730
Yes certainly to predict the function that we wrote for this is different from the one we used in our

341
00:29:19,730 --> 00:29:20,820
cattle or not.

342
00:29:20,860 --> 00:29:21,100
In

343
00:29:24,410 --> 00:29:27,660
um this is it.

344
00:29:27,870 --> 00:29:34,760
There's that cat on not to predict of course it is different this neural network is different.

345
00:29:34,760 --> 00:29:36,820
We've caught our red blue activation.

346
00:29:36,890 --> 00:29:39,500
And then we've got a sigmoid the cat or not.

347
00:29:39,500 --> 00:29:41,360
It's a simple logistic regression.

348
00:29:42,200 --> 00:29:43,430
Um so indeed.

349
00:29:43,430 --> 00:29:44,190
Sorry about that.

350
00:29:44,240 --> 00:29:44,880
Really.

351
00:29:44,910 --> 00:29:47,330
But yeah you learn these things.

352
00:29:47,960 --> 00:29:56,950
Um we're gonna write a predict function from scratch for our new our new example here.

353
00:29:58,280 --> 00:29:59,010
Um.

354
00:29:59,390 --> 00:30:06,530
Um we have our predict function we going to write the part that predicts using our predictive function.

355
00:30:06,530 --> 00:30:07,270
Okay.

356
00:30:07,490 --> 00:30:12,860
So I'm going to write the I'm sorry I was trying to be lazy.

357
00:30:12,870 --> 00:30:16,070
See laziness is but it's a lesson okay.

358
00:30:16,100 --> 00:30:25,610
So we start off by selecting an image the path for the EMH and we see image because N.P. a re in the

359
00:30:25,680 --> 00:30:35,200
image read flatten and then over here we said My MH CI pi MH and then the image size and then we reshape

360
00:30:35,210 --> 00:30:38,240
it to our standard image size.

361
00:30:38,360 --> 00:30:43,660
And over here image prediction I empty prediction of course predict.

362
00:30:46,250 --> 00:30:51,860
Okay over here what I'm gonna do is I'm going to say predict

363
00:30:54,710 --> 00:31:03,010
when I see my image is the image caught my image.

364
00:31:03,040 --> 00:31:04,700
Image predicts image.

365
00:31:04,720 --> 00:31:05,630
This one here

366
00:31:10,690 --> 00:31:12,010
my image actually.

367
00:31:12,070 --> 00:31:14,830
Why did I give this and this the same name.

368
00:31:14,980 --> 00:31:20,960
I call this my AMG my m predict my AMG.

369
00:31:21,010 --> 00:31:21,580
Copy this

370
00:31:24,840 --> 00:31:37,190
and then we need our y labels.

371
00:31:37,550 --> 00:31:38,360
I'm gonna pass

372
00:31:41,550 --> 00:31:44,490
a creative variable here.

373
00:31:44,870 --> 00:31:49,730
Remember our predict function takes x y and z parameters.

374
00:31:49,730 --> 00:31:54,980
So we've got a past the y value of the image we are predicting what a tiny image or not so I'm gonna

375
00:31:54,980 --> 00:31:56,510
create a variable here.

376
00:31:57,310 --> 00:32:01,250
Um I shall call this my Y label.

377
00:32:01,250 --> 00:32:04,750
My y label on my label y.

378
00:32:04,880 --> 00:32:09,880
This equals zero cause image number six.

379
00:32:09,890 --> 00:32:10,760
It's not an image.

380
00:32:10,850 --> 00:32:11,890
It's not a cut.

381
00:32:12,410 --> 00:32:14,090
I m g six years not a cut.

382
00:32:14,090 --> 00:32:19,570
Let's see what are the neural network would be able to distinguish that show.

383
00:32:19,610 --> 00:32:28,010
I'm gonna pass the Y here and then I'm gonna pass parameters we have parameters from somewhere.

384
00:32:30,990 --> 00:32:31,380
Okay.

385
00:32:31,390 --> 00:32:35,400
This the word parameters just pass this over here.

386
00:32:47,080 --> 00:32:47,520
Over here.

387
00:32:47,530 --> 00:32:51,730
My label y and then parameters.

388
00:32:52,060 --> 00:32:53,350
Okay.

389
00:32:54,100 --> 00:32:55,820
Then we showed each image.

390
00:32:55,840 --> 00:32:57,350
Then we squeeze.

391
00:32:58,680 --> 00:32:59,120
Okay

392
00:33:08,370 --> 00:33:10,920
prediction is we simply okay.

393
00:33:10,920 --> 00:33:13,740
Put what did prediction is correct or not.

394
00:33:14,340 --> 00:33:14,690
Okay.

395
00:33:14,700 --> 00:33:21,090
I'm gonna run this and I'm gonna skip that train in bit I'm gonna post the video when it's done training

396
00:33:21,110 --> 00:33:21,650
we do it.

397
00:33:24,200 --> 00:33:32,810
Okay so we've done we're done training parameters is not defined in Kristin

398
00:33:36,350 --> 00:33:38,050
parameters is not defined.

399
00:33:38,510 --> 00:33:44,660
Okay let's see.

400
00:33:44,660 --> 00:33:45,050
Yeah.

401
00:33:45,170 --> 00:33:47,920
You generally need to forgive me here.

402
00:33:47,930 --> 00:33:55,560
Cause when we when we did our training we started that result in a list called Para parameters.

403
00:33:55,790 --> 00:33:57,760
This typo here you see.

404
00:33:57,760 --> 00:33:59,800
So this is where our problem is.

405
00:34:00,050 --> 00:34:00,830
This is para.

406
00:34:00,830 --> 00:34:04,650
This should be parameters with an E but it's called parameters.

407
00:34:04,670 --> 00:34:08,000
So when I come in I call it s you know what I predict here.

408
00:34:08,030 --> 00:34:09,250
It couldn't recognize it.

409
00:34:09,260 --> 00:34:16,100
So I generally um request for your forgiveness.

410
00:34:16,100 --> 00:34:16,590
Yeah.

411
00:34:17,090 --> 00:34:19,460
Um show parameters.

412
00:34:19,640 --> 00:34:20,460
And then we pass it.

413
00:34:20,480 --> 00:34:20,850
Okay.

414
00:34:20,870 --> 00:34:23,130
Let's run it.

415
00:34:23,570 --> 00:34:25,730
I'm gonna save this.

416
00:34:25,730 --> 00:34:27,320
I'm gonna train.

417
00:34:28,810 --> 00:34:29,420
Okay.

418
00:34:37,210 --> 00:34:40,480
We still have an arrow somewhere right.

419
00:34:40,500 --> 00:34:46,400
The arrows because I copied pause here and pasted it as arguments over here.

420
00:34:46,560 --> 00:34:50,780
We have to change the typo from here and here as well.

421
00:34:52,770 --> 00:34:54,390
Let's run again.

422
00:34:54,390 --> 00:34:55,880
I'm gonna train.

423
00:34:57,420 --> 00:34:57,860
Okay

424
00:35:06,370 --> 00:35:08,290
okay so this is it.

425
00:35:09,490 --> 00:35:10,510
Um there's the image.

426
00:35:11,710 --> 00:35:12,610
Oh I.

427
00:35:12,610 --> 00:35:16,890
One is complete because your prediction says a zero.

428
00:35:17,050 --> 00:35:20,210
Our neural network was able to tell us this is not a cut.

429
00:35:20,290 --> 00:35:22,450
The prediction is zero.

430
00:35:22,590 --> 00:35:23,440
A crazy one.

431
00:35:23,470 --> 00:35:32,450
Okay let's try another another image this time let's try an actual cut.

432
00:35:32,500 --> 00:35:42,750
Let's go to our images folder and I'm going to select how about I am G2 gonna come over here.

433
00:35:42,790 --> 00:35:50,440
I empty to end the Y label of I am due to the actual y is 1 meaning it s a cut.

434
00:35:50,440 --> 00:35:51,820
Now let's run this

435
00:35:56,540 --> 00:36:03,230
okay and okay we could predict this to be a cut.

436
00:36:03,230 --> 00:36:10,010
So as you can see it says the accuracy is zero.

437
00:36:10,010 --> 00:36:16,070
Prediction is zero meaning we were supposed to predict this as a cut but a neural network wasn't able

438
00:36:16,070 --> 00:36:16,790
to predict this.

439
00:36:16,820 --> 00:36:20,360
Therefore our accuracy zero and the prediction is you.

440
00:36:20,420 --> 00:36:28,220
So you can try to edit images and um you can download more images from the Internet to try and um also

441
00:36:28,280 --> 00:36:34,730
you can play with the um the hyper parameters of the new network and currently our hyper parameters

442
00:36:34,790 --> 00:36:43,420
is the number of hidden layers you can you know use 10 hidden nodes and see what you get.

443
00:36:43,460 --> 00:36:48,800
You can also play with the um the lending rate and you can play with the number of iterations to see

444
00:36:48,800 --> 00:36:52,800
whether you can get better down to 72 percent accuracy.

445
00:36:52,880 --> 00:37:01,510
Currently our accuracy is at 72 percent so you can change the head in a number of feet and let us make

446
00:37:02,090 --> 00:37:03,020
this an H.

447
00:37:03,020 --> 00:37:10,520
You can use more n h value to see you can train longer you can certainly play with the learning rate

448
00:37:10,550 --> 00:37:15,980
to see what you can get something better than seventy two percent so far this what we have and you can

449
00:37:15,980 --> 00:37:21,290
test with more images different cuts images and see what you have if you have any questions just send

450
00:37:21,290 --> 00:37:23,930
me a message and I'll see you in the next lesson.

451
00:37:24,010 --> 00:37:25,250
All there is.

452
00:37:25,250 --> 00:37:25,870
See you later.
