Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created February 6, 2021 15:49
model = models.Sequential([
layers.Dense(16, activation = 'relu', input_shape = Xtrain[0].shape),
layers.Dense(8, activation = 'relu'),
layers.Dense(1, activation = 'sigmoid')
])
cb = callbacks.EarlyStopping(patience = 5, restore_best_weights = True)
model.compile(optimizer = optimizers.Adam(0.01), loss = losses.BinaryCrossentropy(), metrics = ['accuracy'])
history = model.fit(Xtrain, ytrain, validation_data = (Xval, yval), epochs = 256, callbacks = cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment