Skip to content

Instantly share code, notes, and snippets.

@crawftv
Last active April 11, 2019 03:52
Show Gist options
  • Save crawftv/d99d269cc1e2ff2a74f1a98896958f0b to your computer and use it in GitHub Desktop.
Save crawftv/d99d269cc1e2ff2a74f1a98896958f0b to your computer and use it in GitHub Desktop.
Skopt Tutorial - Baseline NN
# the usual imports for a vanilla nueral net
import keras
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(16, input_shape=input_shape, activation='relu',name = 'input_layer'))
model.add(Dense(16, activation='relu', name="hidden_layer"))
model.add(Dense(10,activation='softmax',name="output_layer"))
model.compile(optimizer = 'adam', loss='categorical_crossentropy', metrics=["accuracy"])
#model.summary prints a description of the model
#model.summary()
#model history is stored as "blackbox".
blackbox = model.fit(X_train, y_train, batch_size=128, epochs =3, validation_split=.15)
accuracy = model.evaluate(X_test,y_test)[1]
print(accuracy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment