Last active
August 13, 2019 20:16
-
-
Save techwithshadab/2e8b15bf85c64b314fdc22e75337ca81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nb_epoch = 10 | |
| batch_size = 16 | |
| labs = train_data.iloc[:,1].values.tolist() | |
| ## Callback for loss logging per epoch | |
| class LossHistory(Callback): | |
| def on_train_begin(self, logs={}): | |
| self.losses = [] | |
| self.val_losses = [] | |
| def on_epoch_end(self, batch, logs={}): | |
| self.losses.append(logs.get('loss')) | |
| self.val_losses.append(logs.get('val_loss')) | |
| early_stopping = EarlyStopping(monitor='val_loss', patience=3, verbose=1, mode='auto') | |
| history = LossHistory() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment