Commit 6247e8cb authored by Petra's avatar Petra

ANN - validation set scaled to [0,1]

parent fee285f0
......@@ -4,7 +4,6 @@
"""https://machinelearningmastery.com/handwritten-digit-recognition-using-convolutional-neural-networks-python-keras/"""
import numpy
from keras.datasets import mnist
from keras.models import Sequential
......@@ -31,6 +30,7 @@ X_train, X_validation, y_train, y_validation = train_test_split(X_train, y_train
# normalize inputs from 0-255 to 0-1
X_train = X_train / 255
X_validation = X_validation / 255
X_test = X_test / 255
# one hot encode outputs
......
......@@ -34,6 +34,7 @@ X_train, X_validation, y_train, y_validation = train_test_split(X_train, y_train
# normalize inputs from 0-255 to 0-1
X_train = X_train / 255
X_validation = X_validation / 255
X_test = X_test / 255
# one hot encode outputs
y_train = np_utils.to_categorical(y_train)
......
......@@ -30,6 +30,7 @@ X_test = X_test.reshape(X_test.shape[0], 1, 28, 28).astype('float32')
X_train, X_validation, y_train, y_validation = train_test_split(X_train, y_train, test_size=0.1, random_state=42)
# normalize inputs from 0-255 to 0-1
X_train = X_train / 255
X_validation = X_validation / 255
X_test = X_test / 255
# one hot encode outputs
y_train = np_utils.to_categorical(y_train)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment