Right.
Welcome back.
So this might I do.
I'm going to create a new script so I'll come to follow over here.
New and then I'm going to press control.
Yes.
And I'm going to navigate.
I'm going to navigate to uh um my project folder is cut or not over here.
I'm going to call this helper.
There's going to be the name of the script and I'm going to write a function in this script to help
us load a war.
What data what in your network.
I'll start off by importing num pi import num pi
S and P.
Like this.
Once that is done I'm going to import H5 pi.
Remember there's the format of what image data once that's done.
I'm going to write my function I'll say it.
Def load data set and then come here like this.
Okay.
I'm gonna create a variable quote train data set.
We're gonna have train and test data set.
We're going to have the training set is going to have its x values its y values to test set is going
to have the same thing.
I'll say train data set
and all we have to do is read I far so see
H5 pi data file and then we find a file in our food our code data set
in the name of the file this is trained you makes data Delta H5
and we said we are reading it.
So we pass are over here like this.
Okay.
So once we've read a file we are going to take the x values and story tonight a separate variable and
a wife I'll use in a separate variable to do it I'm gonna see cranes set X original because then I'll
see an umpire ray which we've renamed to NDP num pi dot array and then obviously train data which is
this variable we've created here
what I want to do is say
Crane sets X and then there's the first index and then the second one we see the semicolon for all right
what is this going to do is this is going to get the features this is gonna get a features of the training
sets which are the x values and then I'm gonna do for the y values as well as a train set y or rage
I'm going to straighten this variable and then we'll see and Peter s a ray
Crane set
and then when a pass Crane set y I'm typing this because this the way I want H5 data is arranged internally
right.
Right.
So what we've just done is for Crane data set.
This is for the training set.
Next we going to take the test set and put it into it's X and then it's y.
So I'm gonna come down here and see test data set because each 5 pi that's fine and is the same file
is not the same file that we have quite different file for test of course we'll see a data sets
slash test AMG data that H5 then a POS are here for read once that is done I'm going to see test set
next original
and I'm simply going to copy what I have here and rename it
this over here becomes test set.
This becomes test as well.
Then I'm going to do for why put this
this becomes test
this becomes test.
This becomes test as well.
So once this is done we going to grab a list of classes and storage in a variable called classes.
Come over here C classes equals empty array and then I'm gonna say
test data set
and then list classes
right.
I'm gonna grab all storage and classes.
Okay.
We're almost done.
What we have to do now is simply reshape the DIY set for the training set and the test set.
So I'm gonna come here and see cranes set.
Y RH which is the original y set.
I see a train set y original to reshape and then what I want to do is one by and I'm going to grab the
one I grew up this
dot shape index 0 right and I'm going to do the same for the test set.
Come over here and then this becomes test
just becomes test
this becomes test right.
Once this is done we can complete our function by returning the data we've processed or return to the
sets we have processed and rearranged so I'll say return over here we can return train set X or rage
and then we can return train set y or regional.
So break and then test set X brake.
I forgot the word set over here
and then test set y a rake.
Um we have the last one.
Classes over here we can return to as well put over here to return.
Right.
So there is going to be a Y.
Help File we shall be adding new functions to this as we go through the course.
So now um we are done with this function.
We shall use this function in a 1 your network script um and we cannot test it now.
We test it when we load it during the um the neural network scripting.
So if you have any questions just let me know.
But for now this all there is for this particular lesson.
I'll see you later.