Skip to content

Commit de286fd

Browse files
rossbarmelissawm
authored andcommitted
PERF: subsample test image set in mnist tutorial.
1 parent a3e8938 commit de286fd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

content/tutorial-deep-learning-on-mnist.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,18 @@ print('The data type of training images: {}'.format(x_train.dtype))
201201
print('The data type of test images: {}'.format(x_test.dtype))
202202
```
203203

204-
**2.** Normalize the arrays by dividing them by 255 (and thus promoting the data type from `uint8` to `float64`) and then assign the train and test image data variables — `x_train` and `x_test` — to `training_images` and `train_labels`, respectively. To make the neural network model train faster in this example, `training_images` contains only 1,000 samples out of 60,000. To learn from the entire sample size, change the `sample` variable to `60000`.
204+
**2.** Normalize the arrays by dividing them by 255 (and thus promoting the data type from `uint8` to `float64`) and then assign the train and test image data variables — `x_train` and `x_test` — to `training_images` and `train_labels`, respectively.
205+
To reduce the model training and evaluation time in this example, only a subset
206+
of the training and test images will be used.
207+
Both `training_images` and `test_images` will contain only 1,000 samples each out
208+
of the complete datasets of 60,000 and 10,000 images, respectively.
209+
These values can be controlled by changing the `training_sample` and
210+
`test_sample` below, up to their maximum values of 60,000 and 10,000.
205211

206212
```{code-cell} ipython3
207-
sample = 1000
208-
training_images = x_train[0:sample] / 255
209-
test_images = x_test / 255
213+
training_sample, test_sample = 1000, 1000
214+
training_images = x_train[0:training_sample] / 255
215+
test_images = x_test[0:test_sample] / 255
210216
```
211217

212218
**3.** Confirm that the image data has changed to the floating-point format:

0 commit comments

Comments
 (0)