-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_logs.py
More file actions
30 lines (26 loc) · 933 Bytes
/
plot_logs.py
File metadata and controls
30 lines (26 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from matplotlib import pyplot as plt
import numpy as np
import argparse
rough = np.load('data/rough.npy')
rough = rough.reshape(rough.shape[0])
window_len = 101
s=np.r_[rough[window_len-1:0:-1], rough, rough[-2:-window_len-1:-1]]
w=np.ones(window_len,'d')
rough=np.convolve(w/w.sum(),s,mode='valid')
smooth = np.load('data/gradient.npy')
smooth = smooth.reshape(smooth.shape[0])
s=np.r_[smooth[window_len-1:0:-1], smooth, smooth[-2:-window_len-1:-1]]
w=np.ones(window_len,'d')
smooth=np.convolve(w/w.sum(),s,mode='valid')
size = min(len(rough), len(smooth)) - 1
rough = rough[0 : size]
smooth = smooth[0 : size]
rough = rough.reshape((rough.shape[0],1))
smooth = smooth.reshape((smooth.shape[0],1))
data = np.concatenate((rough, smooth), axis=1)
plt.plot(data)
plt.title('Landscape Effect on Generalisation')
plt.xlabel('Steps')
plt.ylabel('Generalisation (sgima)')
plt.legend(['Rough landscape', 'Smooth landscape'])
plt.show()