Last active
April 12, 2020 12:24
-
-
Save sadimanna/1aced7967b13f9fbbec1a52f67e48fea 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
class Plotter(botCallback): | |
def __init__(self,access_token): | |
super().__init__(access_token) | |
def on_train_begin(self,logs=None): | |
self.batch = 0 | |
self.epoch = [] | |
self.train_loss = [] | |
self.val_loss = [] | |
self.train_acc = [] | |
self.val_acc = [] | |
self.fig = plt.figure(figsize=(200,100)) | |
self.logs = [] | |
def on_epoch_end(self, epoch, logs=None): | |
self.logs.append(logs) | |
self.epoch.append(epoch) | |
self.train_loss.append(logs['loss']) | |
self.val_loss.append(logs['val_loss']) | |
self.train_acc.append(logs['accuracy']) | |
self.val_acc.append(logs['val_accuracy']) | |
f,(ax1,ax2) = plt.subplots(1,2,sharex=True) | |
clear_output(wait=True) | |
ax1.plot(self.epoch, self.train_loss, label='Training Loss') | |
ax1.plot(self.epoch, self.val_loss, label='Validation Loss') | |
ax1.legend() | |
ax2.plot(self.epoch, self.train_acc, label='Training Accuracy') | |
ax2.plot(self.epoch, self.val_acc, label='Validation Accuracy') | |
ax2.legend() | |
plt.savefig('Accuracy and Loss plot.jpg') | |
self.send_photo('/content/Accuracy and Loss plot.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment