Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created January 22, 2021 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/f985787f718e43b2734d6f3ab8e75bbc to your computer and use it in GitHub Desktop.
Save AyishaR/f985787f718e43b2734d6f3ab8e75bbc to your computer and use it in GitHub Desktop.
model = models.Sequential([
layers.Dense(16, activation = 'relu', input_shape = Xtrain[0].shape),
layers.Dense(4, activation = 'relu'),
layers.Dense(1, activation = 'sigmoid')
])
cb = [callbacks.EarlyStopping(patience = 5, restore_best_weights = True)]
model.compile(optimizer = optimizers.Adam(0.0001), loss = losses.BinaryCrossentropy(), metrics = ['accuracy'])
history = model.fit(Xtrain, ytrain, validation_data = (Xval, yval), epochs = 128, callbacks = cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment