So what will handling this look like in code?
In the previous lesson,
you learned about TensorFlow and Keras,
and how to define a super
simple neural network with them.
In this lesson, you're going to use them to go a little
deeper but the overall API should look familiar.
The one big difference will be in the data.
The last time you had your six pairs of numbers,
so you could hard code it.
This time you have to load 70,000 images off the disk,
so there'll be a bit of code to handle that.
Fortunately, it's still quite
simple because Fashion-MNIST
is available as a data set
with an API call in TensorFlow.
We simply declare an object of
type MNIST loading it from the Keras database.
On this object, if we call the load data method,
it will return four lists to us.
That's the training data, the training labels,
the testing data, and the testing labels.
Now, what are these you might ask?
Well, when building a neural network like this,
it's a nice strategy to use some of
your data to train the neural network and
similar data that the model hasn't yet seen
to test how good it is at recognizing the images.
So in the Fashion-MNIST data set,
60,000 of the 70,000
images are used to train the network,
and then 10,000 images,
one that it hasn't previously seen,
can be used to test just how
good or how bad it is performing.
So this code will give you those sets.
Then, each set has data,
the images themselves and
labels and that's what the image is actually of.
So for example,
the training data will contain images like this one,
and a label that describes the image like this.
While this image is an ankle boot,
the label describing it is the number nine.
Now, why do you think that might be?
There's two main reasons.
First, of course, is that computers do
better with numbers than they do with texts.
Second, importantly, is that
this is something that can help us reduce bias.
If we labeled it as an ankle boot,
we would be of course biasing towards English speakers.
But with it being a numeric label,
we can then refer to it in
our appropriate language be it English,
Chinese, Japanese, or here, even Irish Gaelic.