-
Notifications
You must be signed in to change notification settings - Fork 0
/
training_plots.py
57 lines (39 loc) · 1.5 KB
/
training_plots.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import numpy as np
import json
import matplotlib.pyplot as plt
fdir = 'bars_no_cc/plots/training'
for file in sorted(os.listdir(fdir+'/valid'), key=lambda x : int(x.split('_')[7].split('=')[-1])):
if not '.json' in file:
continue
with open(f'{fdir}/valid/{file}', 'r') as f:
name = file.split('_')
name = name[7].split('=')[-1] + '/' + name[4].split('=')[-1]
data = json.load(f)
data = [d[2] for d in data]
plt.plot(data, label=name, marker='.')
plt.title('folkbar-VAE validation ELBO over epochs', fontweight='bold')
plt.legend()
plt.xticks(range(0,21))
plt.ylim(14)
plt.savefig(f'{fdir}/folkbar-VAE_valid.png', dpi=200)
'''
fdir = 'full_tunes/plots/training'
for file in sorted(os.listdir(fdir+'/kl'), key=lambda x : int(x.split('_')[7].split('=')[-1])):
if not '.json' in file:
continue
with open(f'{fdir}/kl/{file}', 'r') as f:
name = file.split('_')
name = name[7].split('=')[-1] + '/' + name[4].split('=')[-1]
data = json.load(f)
data = [d[2] for d in data]
epoch = len(data)//20
new_data = [data[min(epoch*i, epoch*20-1)] for i in range(21)]
#new_data = [np.sum(data[:epoch*(i+1)])/(epoch*(i+1)) for i in range(21)]
plt.plot(new_data, label=name, marker='.')
plt.title('folktune-VAE validation true KL-Divergence over epochs', fontweight='bold')
plt.legend()
plt.xticks(range(0,21))
plt.yscale('log')
plt.savefig(f'{fdir}/folktune-VAE_true_kl.png', dpi=200)
'''