# Import Libraries import os import tensorflow as tf import pandas as pd import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg plt.style.use('fivethirtyeight') def plot_performance(hist): hist_ = hist.history epochs = hist.epoch plt.plot(epochs, hist_['accuracy'], label='Training Accuracy') plt.plot(epochs, hist_['val_accuracy'], label='Validation Accuracy') plt.title('Training and validation accuracy') plt.xlabel('Epochs') plt.ylabel('Accuracy') plt.legend() plt.figure() plt.plot(epochs, hist_['loss'], label='Training loss') plt.plot(epochs, hist_['val_loss'], label='Validation loss') plt.title('Training and validation loss') plt.xlabel('Epochs') plt.ylabel('Loss') plt.legend() recall = np.array(hist_['recall']) precision = np.array(hist_['precision']) val_recall = np.array(hist_['val_recall']) val_precision = np.array(hist_['val_precision']) plt.figure() plt.plot(epochs, 2*((recall * precision)/(recall + precision)), label='Training f1') plt.plot(epochs, 2*((val_recall * val_precision)/(val_recall + val_precision)), label='Validation f1') plt.title('Training and validation F1-Score') plt.xlabel('Epochs') plt.ylabel('score') plt.legend() plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter