Search code examples
numpymachine-learningmnist

What does each number represents in MNIST?


I have successfully downloaded MNIST data in files with .npy extension. When I print the few columns of first image. I get the following result. What does each number represent here?

a= np.load("training_set.npy")
print(a[:1,100:200])
print(a.shape)

[[  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   3  18
18  18 126 136 175  26 166 255 247 127   0   0   0   0   0   0   0   0
0   0   0   0  30  36  94 154 170 253 253 253 253 253 225 172 253 242
195  64   0   0   0   0   0   0   0   0]]

(60000, 784)

Solution

  • [[  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
        0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
        0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   3  18
        18  18 126 136 175  26 166 255 247 127   0   0   0   0   0   0   0   0
        0   0   0   0  30  36  94 154 170 253 253 253 253 253 225 172 253 242
        195  64   0   0   0   0   0   0   0   0]]
    

    These are the intensity values (0-255) for each of the 784 pixels (28x28) of a MNIST image; the total number of training images is 60,000 (you'll find 10,000 more images in the test set).

    (60000, 784) means 60,000 samples (images), each one consisting of 784 features (pixel values).