Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Results import *
- import matplotlib.pyplot as plt
- import numpy as np
- # Put all the losses in the same array, and get the averaged losses
- train_bn = np.array([vgg16_bn_1, vgg16_bn_2, vgg16_bn_3, vgg16_bn_4, vgg16_bn_5])
- train_bn = np.mean(train_bn, axis = 0)
- scale = np.linspace(0, 30, len(train_bn))
- # Compute the rolling loss
- rolling_bn = [np.mean(train_bn[i:i+100]) for i in range(len(train_bn) - 100)]
- # Plot
- ax = plt.figure().gca()
- ax.set_xticks(np.arange(0, 31, 1))
- plt.plot(scale, train_bn, label = "Mean of losses on 5 runs")
- plt.plot(scale[:-100], rolling_bn, label = "Rolling loss on 100 minibatches")
- plt.title("Batch Norm")
- plt.grid(axis = 'x', which = 'both' )
- plt.xlabel("Epochs")
- plt.ylabel("Loss")
- plt.legend()
Advertisement
Add Comment
Please, Sign In to add comment