In the following steps, you will learn to preprocess the data before it is fed to the neural network:
- To make sure we get the same result every time we run the experiment, we will pick a random seed for NumPy's random number generator. This way, shuffling the training samples from the MNIST dataset will always result in the same order:
In [1]: import numpy as np... np.random.seed(1337)
- Keras provides a loading function similar to train_test_split from scikit-learn's model_selection module. Its syntax might look strangely familiar to you:
In [2]: from keras.datasets import mnist... (X_train, y_train), (X_test, y_test) = mnist.load_data()
In contrast to other datasets we have encountered so far, MNIST comes ...