Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Created August 13, 2018 16:32
Show Gist options
  • Save SkalskiP/3b9d8313e68aef495fec2351d074d01a to your computer and use it in GitHub Desktop.
Save SkalskiP/3b9d8313e68aef495fec2351d074d01a to your computer and use it in GitHub Desktop.
Simple KERAS neural network for binary classification
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(4, input_dim=2,activation='relu'))
model.add(Dense(6, activation='relu'))
model.add(Dense(6, activation='relu'))
model.add(Dense(4, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(X_train, y_train, epochs=50, verbose=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment