Skip to content

Instantly share code, notes, and snippets.

@vishwanath79
Created June 20, 2020 23:12
Show Gist options
  • Select an option

  • Save vishwanath79/0ce8fd59ba4ce1ce7f856bed08bc68ca to your computer and use it in GitHub Desktop.

Select an option

Save vishwanath79/0ce8fd59ba4ce1ce7f856bed08bc68ca to your computer and use it in GitHub Desktop.

Revisions

  1. vishwanath79 created this gist Jun 20, 2020.
    16 changes: 16 additions & 0 deletions EarlyStopping
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    from keras.callbacks import EarlyStopping
    save_early_callback = EarlyStopping(monitor='val_loss', min_delta=0,
    patience=3, verbose=1,
    restore_best_weights=True)
    model.fit(
    X_train,
    y_train,
    batch_size=64,
    class_weight=class_weight,
    validation_split=0.1,
    epochs=50,
    callbacks=[save_early_callback],
    )