Skip to content

Instantly share code, notes, and snippets.

@drorhilman
Created November 18, 2017 07:39
Show Gist options
  • Save drorhilman/899da9e80427301bdaabce8fbd542fce to your computer and use it in GitHub Desktop.
Save drorhilman/899da9e80427301bdaabce8fbd542fce to your computer and use it in GitHub Desktop.
from keras.layers import Dense, Dropout, Input, BatchNormalization
from keras.models import Model
def get_nn_model(dropout=0.6):
inp = Input(shape = (90,))
x = Dense(100, activation='relu')(inp)
x = BatchNormalization()(x)
x = Dropout(dropout)(x)
x = Dense(50, activation='relu')(x)
x = BatchNormalization()(x)
x = Dropout(dropout)(x)
x = Dense(50, activation='relu')(x)
x = BatchNormalization()(x)
x = Dropout(dropout)(x)
x = Dense(1, activation='sigmoid')(x)
model = Model(inputs=[inp], outputs=[x])
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment