1
00:00:00,600 --> 00:00:01,120
Hello.

2
00:00:01,200 --> 00:00:01,740
Welcome back.

3
00:00:02,130 --> 00:00:09,000
So let's build a truly a neuro network using the functions we created in our library.

4
00:00:09,000 --> 00:00:17,130
In the last lesson I want to create a new I do script a Python script I should say was in New file or

5
00:00:17,130 --> 00:00:28,440
price control s to save and I'm going to save this I'm saving this in the same folder in which we saved

6
00:00:28,470 --> 00:00:31,950
our DNA and life library version one.

7
00:00:32,010 --> 00:00:39,260
I'm going to call this to layer and then simple as that.

8
00:00:39,790 --> 00:00:51,580
And I'm also going to copy the um the help script we wrote for a while logistic regression example followed

9
00:00:51,710 --> 00:00:53,860
in the data cut or no cut.

10
00:00:54,120 --> 00:00:55,410
I'm gonna come over here.

11
00:00:55,440 --> 00:00:57,480
This project to cut or not.

12
00:00:57,570 --> 00:01:00,590
We had this script called helper in the script.

13
00:01:00,590 --> 00:01:01,460
We can take a look at it.

14
00:01:01,530 --> 00:01:05,170
This load at the data for us our H5 file.

15
00:01:05,200 --> 00:01:10,600
This script has just one function and this loads the H5 data for us.

16
00:01:10,710 --> 00:01:15,300
So I'm gonna copy this I'm gonna copy this as well as that data set and images cause we're going to

17
00:01:15,300 --> 00:01:16,610
be using them as well.

18
00:01:16,710 --> 00:01:22,480
Copy to help her bring it all to Leah and then folder paste it over here.

19
00:01:25,550 --> 00:01:29,210
Copy data sets and images

20
00:01:33,440 --> 00:01:35,860
and I'll paste it over here.

21
00:01:37,800 --> 00:01:38,560
Right.

22
00:01:38,760 --> 00:01:45,330
So we've got our in library we've got our helper for loading our data and then we're going to implement

23
00:01:45,330 --> 00:01:47,520
it in your network in this one.

24
00:01:47,520 --> 00:01:48,500
Okay.

25
00:01:48,840 --> 00:01:54,630
So we are going to use the same dataset that we used which is in the H5 four months later on we shall

26
00:01:54,630 --> 00:01:57,150
see how to get actual images.

27
00:01:57,150 --> 00:02:03,930
We're going to download actual images maybe about ten thousand of them and resize them and then pass

28
00:02:03,930 --> 00:02:08,920
them through our neural network but now we can use the H5 format.

29
00:02:09,360 --> 00:02:10,120
Okay.

30
00:02:10,350 --> 00:02:18,090
So let's start off by importing the relevant packages that we need for this project.

31
00:02:18,150 --> 00:02:19,580
So I'm going to import time

32
00:02:24,860 --> 00:02:27,650
once that's done I'm going to import known by us N.P.

33
00:02:32,690 --> 00:02:35,120
and after that I'm going to import H5 by

34
00:02:40,670 --> 00:02:45,450
then and I'm going to import my to plot lib for plotting.

35
00:02:45,500 --> 00:02:59,710
So I'll say import much plot lib dot pi plot SPL T and then I'm going to import CI PI for dealing with

36
00:02:59,710 --> 00:03:07,810
images then O import P Pil Python image in library socio from pill

37
00:03:12,460 --> 00:03:16,530
import Image.

38
00:03:16,720 --> 00:03:23,760
Once that is done I'm going to import a were a y helper.

39
00:03:23,770 --> 00:03:32,280
I'll see from helper to help us scripts we created from helper import load data set does the name of

40
00:03:32,280 --> 00:03:32,920
your function

41
00:03:36,590 --> 00:03:41,770
and I'm also going to import our library.

42
00:03:41,780 --> 00:03:44,480
What's the name of the library.

43
00:03:44,480 --> 00:03:54,460
It's called D and N underscored lib on this coffee one so I say from the in n that's lib on the score

44
00:03:55,630 --> 00:03:56,050
D.

45
00:03:56,160 --> 00:04:00,290
And in this clip on this coffee one import

46
00:04:03,610 --> 00:04:07,950
and then put an asterisk meaning import all the functions.

47
00:04:08,410 --> 00:04:09,350
I'm also.

48
00:04:09,370 --> 00:04:09,610
Yeah.

49
00:04:09,820 --> 00:04:14,040
I think I think we've imported all we need.

50
00:04:14,060 --> 00:04:16,840
Okay okay.

51
00:04:17,040 --> 00:04:19,510
So we can start off by loading our data

52
00:04:22,750 --> 00:04:24,000
before before I do that.

53
00:04:24,010 --> 00:04:28,510
I'm going to set my random number generator to seed.

54
00:04:28,690 --> 00:04:40,480
I'm going to say NDP to random dot seed pass one over here and then I'm going to import my data.

55
00:04:40,500 --> 00:04:49,540
Now like we did before we Queen to call a while load data load data function

56
00:04:52,890 --> 00:04:54,160
let's see the name of the function.

57
00:04:54,160 --> 00:04:54,390
Sure.

58
00:04:54,470 --> 00:04:54,690
The

59
00:05:00,500 --> 00:05:02,990
the function is called late load data set.

60
00:05:03,330 --> 00:05:11,610
And this function is going to return to training set X training set y regional test set X or regional

61
00:05:11,640 --> 00:05:13,680
to set while regional and a class.

62
00:05:14,160 --> 00:05:22,590
Okay so we returnable 5 we return 5 items from this function does the function does the name of the

63
00:05:22,590 --> 00:05:33,750
function and I'm gonna say equal to I'm going to store this in train X or Rick comma

64
00:05:36,810 --> 00:05:46,980
Crane why coma test X or rig for original test.

65
00:05:46,970 --> 00:05:53,620
Why and then classes like this.

66
00:05:54,510 --> 00:05:55,020
Okay.

67
00:05:55,110 --> 00:06:03,640
So after executing this we shall have our data set loaded into their respective variables right.

68
00:06:06,620 --> 00:06:13,200
Now let's explore the data set let's make sure we know what we are dealing with when I come down here

69
00:06:15,750 --> 00:06:25,210
and I'm gonna get the number of training examples by creating a variable called M Train in this course.

70
00:06:25,210 --> 00:06:37,020
Train on the score X original dot shape index 0 right and then a number of pixels.

71
00:06:37,980 --> 00:06:45,260
I'm gonna store that in a variable quote No more p x None P X and this we can get it by doing Crane

72
00:06:45,990 --> 00:06:48,980
gonna score X on a score.

73
00:06:49,220 --> 00:06:54,690
Rick does it shape this time.

74
00:06:54,720 --> 00:07:07,320
Index 1 we can get a number of test examples by doing em test and then we do test score X on the score.

75
00:07:07,340 --> 00:07:12,510
Original that S shape index 0.

76
00:07:13,770 --> 00:07:23,620
Okay so from these three we can um we can print out certain attributes of our dataset.

77
00:07:23,970 --> 00:07:28,460
So just come away here and put a print statement um

78
00:07:31,310 --> 00:07:32,160
see a crayon in

79
00:07:36,060 --> 00:07:37,460
IT training example

80
00:07:42,430 --> 00:07:50,860
and I can just see SDR over here and then get my M Train variable from here.

81
00:07:55,440 --> 00:08:01,260
Right next we can take a look a number of training examples.

82
00:08:01,260 --> 00:08:05,160
So number of images string example images.

83
00:08:05,160 --> 00:08:08,640
And I can print test examples to see print

84
00:08:15,940 --> 00:08:16,930
test examples

85
00:08:19,630 --> 00:08:21,510
see SDR.

86
00:08:21,920 --> 00:08:23,670
And this would give it a name.

87
00:08:23,720 --> 00:08:24,370
M test.

88
00:08:26,760 --> 00:08:27,900
Right.

89
00:08:27,990 --> 00:08:31,250
We can also print the size of each image.

90
00:08:31,420 --> 00:08:32,100
So print

91
00:08:36,340 --> 00:08:44,500
image size and we caught this from our number of pixels number of pixels over here.

92
00:08:50,590 --> 00:08:58,420
So we can simply say plus string number of pixels

93
00:09:02,850 --> 00:09:05,870
and then we do plus and then comma here.

94
00:09:07,460 --> 00:09:10,880
And then plus screen again

95
00:09:16,310 --> 00:09:18,720
no p x.

96
00:09:19,420 --> 00:09:23,870
And then we know it's called three channels.

97
00:09:23,980 --> 00:09:28,780
So I'm gonna put plus and then comb my hair again and then

98
00:09:33,380 --> 00:09:34,810
I'll put three or four here

99
00:09:41,380 --> 00:09:41,940
like this.

100
00:09:43,420 --> 00:09:44,430
Okay.

101
00:09:44,860 --> 00:09:46,340
What else can we print.

102
00:09:48,220 --> 00:09:50,820
Um we can print the shapes.

103
00:09:51,160 --> 00:09:54,550
Come over here print off or print

104
00:09:59,720 --> 00:10:03,680
or see connects reach.

105
00:10:03,940 --> 00:10:06,580
Shape the shape of the print example X

106
00:10:09,520 --> 00:10:10,680
not a shape already.

107
00:10:10,680 --> 00:10:14,820
We can simply do train X or shape to get this

108
00:10:18,640 --> 00:10:20,070
green X or regional.

109
00:10:20,080 --> 00:10:23,950
Copy this patient over here.

110
00:10:23,950 --> 00:10:24,570
The shape.

111
00:10:26,280 --> 00:10:36,760
And then I'm going to put one to put SDR around it.

112
00:10:37,280 --> 00:10:37,910
Right.

113
00:10:38,000 --> 00:10:44,640
And um if you are interested in getting the shape of the others test set you can do the same.

114
00:10:45,680 --> 00:10:50,800
Um we can do for y help but we copy and paste and just so that we do all of them.

115
00:10:51,590 --> 00:10:55,510
Um I'll do train Y

116
00:10:58,870 --> 00:11:00,970
Y shape to get a shape

117
00:11:05,650 --> 00:11:13,020
we simply fetch for from train y we've got train y over here.

118
00:11:13,110 --> 00:11:21,890
Copy this paste over here right here and then I'm going to copy and paste and do it for the others

119
00:11:24,650 --> 00:11:27,110
what it tests it.

120
00:11:28,000 --> 00:11:43,550
So this becomes test becomes test this well test X original becomes test X your original test y

121
00:11:46,140 --> 00:11:48,240
becomes test y like this.

122
00:11:49,020 --> 00:11:53,670
Okay so let's run and see what we'll get from this.

123
00:11:53,670 --> 00:11:59,280
Inspection control is safe click over here run a module.

124
00:11:59,610 --> 00:12:04,930
Okay an error somewhere huh.

125
00:12:06,780 --> 00:12:15,000
So there's an error in our DNA and lip one in our library.

126
00:12:15,000 --> 00:12:16,420
Essentially our library script.

127
00:12:16,420 --> 00:12:17,720
So I'm gonna open it.

128
00:12:21,520 --> 00:12:22,520
Yeah it is.

129
00:12:29,510 --> 00:12:35,540
The arrow is located here in our linear activation forward.

130
00:12:39,990 --> 00:12:45,020
I think is because there's a typo in the word activation over here.

131
00:12:45,690 --> 00:12:48,150
Right.

132
00:12:48,150 --> 00:12:49,770
Line one hundred and eleven

133
00:13:00,320 --> 00:13:02,210
okay.

134
00:13:02,600 --> 00:13:05,010
It's on this line.

135
00:13:05,870 --> 00:13:10,340
Linear activation over here.

136
00:13:10,340 --> 00:13:10,720
Okay.

137
00:13:10,730 --> 00:13:18,410
Control is to save on this run and see like I said the best test for our library is when we start calling

138
00:13:18,410 --> 00:13:20,150
the various functions.

139
00:13:20,320 --> 00:13:22,220
When I run this run module

140
00:13:25,890 --> 00:13:26,680
what does it say.

141
00:13:26,680 --> 00:13:29,180
No well activation is solved.

142
00:13:29,180 --> 00:13:31,000
It says invalid syntax.

143
00:13:31,000 --> 00:13:33,540
Let's see.

144
00:13:33,640 --> 00:13:34,350
Okay.

145
00:13:34,360 --> 00:13:40,360
This is the same file a Y DNA in the library version one far over here.

146
00:13:40,390 --> 00:13:49,390
I have a typo when I did parameters P and I wanted to append l I'm using the square brackets or they

147
00:13:49,390 --> 00:13:49,930
should be.

148
00:13:49,930 --> 00:13:56,920
Is this just like the one we have up here right.

149
00:13:56,990 --> 00:13:58,590
Like we did over here as well.

150
00:13:58,600 --> 00:13:59,800
Contro s too safe.

151
00:13:59,990 --> 00:14:05,300
Let's hope this solves the issue I've saved.

152
00:14:05,300 --> 00:14:07,610
I'm going to run a while mortal again.

153
00:14:07,610 --> 00:14:10,730
Come over here run module.

154
00:14:11,060 --> 00:14:12,360
Voila.

155
00:14:12,620 --> 00:14:15,610
So we have two hundred and nine create an example.

156
00:14:15,620 --> 00:14:21,400
As you can see over here we have a 50 test examples.

157
00:14:21,420 --> 00:14:26,780
The image size is 64 pixels by 64 pixels and we have three channels.

158
00:14:27,410 --> 00:14:37,300
So because of the number of images the pixel size etc the shape of our train train set our train and

159
00:14:37,370 --> 00:14:44,870
dataset is number of training examples which is two hundred and nine by the shape of the image or the

160
00:14:44,870 --> 00:14:45,590
image size.

161
00:14:45,770 --> 00:14:53,940
So we've got two hundred and nine by sixty four sixty four three and test train y.

162
00:14:54,350 --> 00:14:56,990
We have two hundred and nine labels.

163
00:14:56,990 --> 00:15:04,040
What s cut or no cut because the number of examples is two hundred and nine and test is just like we

164
00:15:04,040 --> 00:15:04,760
saw in train.

165
00:15:04,790 --> 00:15:12,470
We've got 50 we've got 50 test examples and in 50 labels for you know the Y.

166
00:15:12,740 --> 00:15:15,800
So we shall continue in the next lesson.

167
00:15:15,830 --> 00:15:16,220
Right.
