Skip to content

Instantly share code, notes, and snippets.

@edumunozsala
Last active September 25, 2020 18:21
Show Gist options
  • Save edumunozsala/b20e847706cd13932d092f0cfbfe569f to your computer and use it in GitHub Desktop.
Save edumunozsala/b20e847706cd13932d092f0cfbfe569f to your computer and use it in GitHub Desktop.
Callback where logs are recorded
# start an Azure ML run
run = Run.get_context()
class LogRunMetrics(Callback):
# callback at the end of every epoch
def on_epoch_end(self, epoch, log):
# log a value repeated which creates a list
run.log('Loss', log['loss'])
run.log('Accuracy', log['acc'])
run.log('Val_Loss', log['val_loss'])
run.log('Val_Accuracy', log['val_acc'])
# Reduce LR
ReduceLROnPlateau(monitor='val_loss', factor=0.2, patience=5, verbose=0, cooldown=2, min_lr=0.0001)
run.log('LearningRate',self.model.optimizer.lr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment