-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_losses.py
39 lines (30 loc) · 1.03 KB
/
plot_losses.py
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
31
32
33
34
35
36
37
38
39
import matplotlib.pyplot as plt
import numpy as np
def plot(file):
try:
plt.style.use('ggplot')
data = np.loadtxt(f"{file}.csv", delimiter=',', skiprows=0)
fig, ax = plt.subplots(figsize=(16, 9))
x = np.arange(data.shape[0])
ax.plot(x, data[:, 0], label='Loss')
ax.legend()
plt.savefig(f"{file}.png", bbox_inches='tight')
plt.close()
except Exception as e:
print(e)
filename = 'data/saves/%s/results/%s' # without extension
# for i in range(17):
# plot(filename % (i, 'training_loss'))
#
# plot(filename % (17, 'training_loss-0'))
# plot(filename % (17, 'training_loss-1'))
#for i in range(18, 30):
# plot(filename % (i, 'training_loss'))
#
#plot('data/saves/34/results/training_loss')
#plot('data/saves/10-bis/results/training_loss')
#plot('data/saves/35/after-1-game/results/training_loss')
#for i in range(2, 6):
# plot(f'data/saves/35/after-{i}-games/results/training_loss')
for i in range(4):
plot(plot(filename % (36, f'training_loss-{i}')))