1
00:00:00,000 --> 00:00:03,575
So what will handling
this look like in code?

2
00:00:03,575 --> 00:00:04,990
In the previous lesson,

3
00:00:04,990 --> 00:00:06,860
you learned about
TensorFlow and Keras,

4
00:00:06,860 --> 00:00:08,320
and how to define a super

5
00:00:08,320 --> 00:00:10,150
simple neural network with them.

6
00:00:10,150 --> 00:00:13,120
In this lesson, you're going
to use them to go a little

7
00:00:13,120 --> 00:00:16,300
deeper but the overall API
should look familiar.

8
00:00:16,300 --> 00:00:18,670
The one big difference
will be in the data.

9
00:00:18,670 --> 00:00:21,070
The last time you had
your six pairs of numbers,

10
00:00:21,070 --> 00:00:22,450
so you could hard code it.

11
00:00:22,450 --> 00:00:26,010
This time you have to load
70,000 images off the disk,

12
00:00:26,010 --> 00:00:28,180
so there'll be a bit of
code to handle that.

13
00:00:28,180 --> 00:00:29,800
Fortunately, it's still quite

14
00:00:29,800 --> 00:00:31,705
simple because Fashion-MNIST

15
00:00:31,705 --> 00:00:33,250
is available as a data set

16
00:00:33,250 --> 00:00:35,290
with an API call in TensorFlow.

17
00:00:35,290 --> 00:00:37,540
We simply declare an object of

18
00:00:37,540 --> 00:00:41,325
type MNIST loading it
from the Keras database.

19
00:00:41,325 --> 00:00:44,715
On this object, if we call
the load data method,

20
00:00:44,715 --> 00:00:47,010
it will return four lists to us.

21
00:00:47,010 --> 00:00:49,465
That's the training data,
the training labels,

22
00:00:49,465 --> 00:00:52,265
the testing data, and
the testing labels.

23
00:00:52,265 --> 00:00:54,230
Now, what are these
you might ask?

24
00:00:54,230 --> 00:00:57,470
Well, when building
a neural network like this,

25
00:00:57,470 --> 00:00:59,690
it's a nice strategy
to use some of

26
00:00:59,690 --> 00:01:02,600
your data to train
the neural network and

27
00:01:02,600 --> 00:01:05,570
similar data that
the model hasn't yet seen

28
00:01:05,570 --> 00:01:08,935
to test how good it is at
recognizing the images.

29
00:01:08,935 --> 00:01:11,265
So in the Fashion-MNIST data set,

30
00:01:11,265 --> 00:01:13,600
60,000 of the 70,000

31
00:01:13,600 --> 00:01:15,815
images are used to
train the network,

32
00:01:15,815 --> 00:01:17,795
and then 10,000 images,

33
00:01:17,795 --> 00:01:20,015
one that it hasn't
previously seen,

34
00:01:20,015 --> 00:01:22,070
can be used to test just how

35
00:01:22,070 --> 00:01:24,605
good or how bad it is performing.

36
00:01:24,605 --> 00:01:27,470
So this code will
give you those sets.

37
00:01:27,470 --> 00:01:29,815
Then, each set has data,

38
00:01:29,815 --> 00:01:31,500
the images themselves and

39
00:01:31,500 --> 00:01:34,820
labels and that's what
the image is actually of.

40
00:01:34,820 --> 00:01:37,070
So for example,

41
00:01:37,070 --> 00:01:40,460
the training data will
contain images like this one,

42
00:01:40,460 --> 00:01:43,265
and a label that describes
the image like this.

43
00:01:43,265 --> 00:01:45,530
While this image
is an ankle boot,

44
00:01:45,530 --> 00:01:48,200
the label describing
it is the number nine.

45
00:01:48,200 --> 00:01:50,440
Now, why do you
think that might be?

46
00:01:50,440 --> 00:01:52,605
There's two main reasons.

47
00:01:52,605 --> 00:01:54,680
First, of course, is
that computers do

48
00:01:54,680 --> 00:01:56,870
better with numbers than
they do with texts.

49
00:01:56,870 --> 00:01:59,120
Second, importantly, is that

50
00:01:59,120 --> 00:02:01,505
this is something that
can help us reduce bias.

51
00:02:01,505 --> 00:02:03,935
If we labeled it
as an ankle boot,

52
00:02:03,935 --> 00:02:07,190
we would be of course biasing
towards English speakers.

53
00:02:07,190 --> 00:02:09,065
But with it being
a numeric label,

54
00:02:09,065 --> 00:02:10,460
we can then refer to it in

55
00:02:10,460 --> 00:02:13,040
our appropriate language
be it English,

56
00:02:13,040 --> 00:02:17,100
Chinese, Japanese, or
here, even Irish Gaelic.