How to visualize the history of network learning: accuracy, loss in graphs using matplotlib

Alex G.
1 min readNov 9, 2020

--

How to visualize the history of network learning: accuracy, loss in graphs (Photo,GIF by Author) https://github.com/oleksandr-g-rock/How_to_create_confusion_matrix/blob/main/1_eaS-en2hydBlVhhLyQKg_Q.png

Short summary:

This article most the same as my previous article but with little changes:

If you want just to look at the notebook or just run code please click here

So, Let’s start :)

So for visualizing the history of network learning: accuracy, loss in graphs
you need to run this code after your training

#Plot the Graph# Loss Curves
plt.figure(figsize=[8,6])
plt.plot(history.history['loss'],'r',linewidth=3.0)
plt.plot(history.history['val_loss'],'b',linewidth=3.0)
plt.legend(['Training loss', 'Validation Loss'],fontsize=18)
plt.xlabel('Epochs ',fontsize=16)
plt.ylabel('Loss',fontsize=16)
plt.title('Loss Curves',fontsize=16)

# Accuracy Curves
plt.figure(figsize=[8,6])
plt.plot(history.history['accuracy'],'r',linewidth=3.0)
plt.plot(history.history['val_accuracy'],'b',linewidth=3.0)
plt.legend(['Training Accuracy', 'Validation Accuracy'],fontsize=18)
plt.xlabel('Epochs ',fontsize=16)
plt.ylabel('Accuracy',fontsize=16)
plt.title('Accuracy Curves',fontsize=16)

we should have a result like this:

How to visualize the history of network learning: accuracy, loss in graphs (Photo,GIF by Author) https://github.com/oleksandr-g-rock/How_to_create_confusion_matrix/blob/main/1_KDKvFq4wn_3UCDeZwkVklQ.png

Result:

We created the visualize the history of network learning: accuracy, loss in graphs via matplotlib.
If you want just to look at the notebook or just run code please click here

--

--

Alex G.
Alex G.

Written by Alex G.

ML DevOps engineer. 🙂 I am always open to new opportunities and offers. 🖖 I trying to help the world 🌏 with machine learning.

No responses yet