-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_hparam_bins.py
47 lines (36 loc) · 1.29 KB
/
plot_hparam_bins.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
import os
from matplotlib import pyplot as plt
import json
dataset = "LSAC"
path = os.path.join("final_logs", "complete_runs", dataset, "ARL", "seed_run_version_seclr", dataset+"_gridsearch_results.json")
"""
###################################################################################
# Save gridsearch results
data = {}
data["batchsize"] = []
data["prim_lr"] = []
data["sec_lr"] = []
data["auc"] = []
with open(path, "r") as f:
line = f.readline()
while line:
data["batchsize"].append(int(line[53:56].strip()))
data["prim_lr"].append(float(line[67:73].strip()))
data["sec_lr"].append(float(line[78:84].strip()))
data["auc"].append(float(line[114:123].strip()))
line = f.readline()
with open('LSAC_gridsearch_results.json', 'w') as outfile:
json.dump(data, outfile)
###################################################################################
"""
###################################################################################
# Read gridsearch results
with open(path, "r") as f:
data = json.load(f)
plt.figure(figsize=(12, 8))
plt.hist(data["auc"], bins=80)
plt.yticks(fontsize=12)
plt.xticks(fontsize=12)
plt.ylabel("Number of hparam configurations", fontsize=16)
plt.xlabel("AUC", fontsize=16)
plt.show()