Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created April 18, 2021 18:26
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/6b34e568d8a77c43ac6eb0071b659bf5 to your computer and use it in GitHub Desktop.
Save AyishaR/6b34e568d8a77c43ac6eb0071b659bf5 to your computer and use it in GitHub Desktop.
model = models.Sequential([
layers.Dense(256, activation = 'relu', input_shape = Xtrain[0].shape),
layers.Dense(64, activation = 'relu'),
layers.Dense(16, activation = 'relu'),
layers.Dense(4, activation = 'softmax')
])
cb = [callbacks.EarlyStopping(patience = 5, restore_best_weights = True)]
model.compile(optimizer=optimizers.Adam(0.0001), loss=losses.CategoricalCrossentropy(), metrics=['accuracy'])
history = model.fit(Xtrain, ytrain, epochs = 256, validation_data = (Xval, yval), callbacks = cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment