- First Step
# define the function
def training_vis (hist):
loss = hist.history[' loss ']
Val_loss = hist.history[' Val_ Loss ']
acc = hist.history[' acc ']
VAL_ACC = hist.history[' Val_acc ']
# make a figure
fig = plt.figure ( Figsize= (8,4))
# subplot loss
Ax1 = fig.add_subplot (121)
Ax1.plot (loss,label= ' Train_loss ')
Ax1.plot (val_loss,label= ' Val_loss ')
ax1.set_xlabel (' epochs ')
Ax1.set_ylabel (' loss ')
ax1.set_ Title (' Loss on Training and Validation Data ')
ax1.legend ()
# subplot acc
ax2 = fig.add_subplot (122)
ax2.plot (acc,label= ' TRAIN_ACC ')
ax2.plot (val_acc,label= ' VAL_ACC ')
ax2.set_xlabel (' epochs ')
Ax2.set_ylabel (' accuracy ')
ax2.set_title (' accuracy on Training and Validation Data ')
Ax2.legend ()
plt.tight_layout ()
Step Two
# Train the model
hist = Model.fit (...)
Step three
# Call the function
Training_vis (hist)