Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Create Train and validation data to check the performance at each epoch
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, test_size=0.2)
# Using Keras Sequential API to add neural network layers
model = keras.Sequential()
model.add(keras.layers.Conv2D(32, kernel_size=(3, 3),activation='relu',input_shape=(28,28,1)))
model.add(keras.layers.Conv2D(64, (3, 3), activation='relu'))
model.add(keras.layers.MaxPooling2D(pool_size=(2, 2)))
model.add(keras.layers.Dropout(0.25))
model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(128, activation='relu'))
model.add(keras.layers.Dropout(0.5))
model.add(keras.layers.Dense(10, activation='softmax'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.