Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from keras.utils import np_utils
- # Transofrm them to a float32 type
- x_train = x_train.astype('float32')
- x_test = x_test.astype('float32')
- # Normalize the input
- x_train /= 255
- x_test /= 255
- # One-hot Encoding
- num_classes = 10
- y_train = np_utils.to_categorical(y_train, num_classes)
- y_test = np_utils.to_categorical(y_test, num_classes)
Add Comment
Please, Sign In to add comment