-
Notifications
You must be signed in to change notification settings - Fork 0
/
label_with_scores.py
72 lines (56 loc) · 1.78 KB
/
label_with_scores.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pickle as pkl
import numpy as np
import os
import glob
import design_bench as db
if __name__ == "__main__":
task = db.make("CIFARNAS-Exact-v0")
task.map_to_logits()
task.map_normalize_x()
with open('final_output.pkl', 'rb') as f:
final_output = pkl.load(f)
baselines = [
"autofocused-cbas",
"cbas",
"bo-qei",
"cma-es",
"gradient-ascent",
"gradient-ascent-min-ensemble",
"gradient-ascent-mean-ensemble",
"mins",
"reinforce"
]
baseline_to_iteration = {
"autofocused-cbas": 20,
"cbas": 20,
"bo-qei": 10,
"cma-es": 0,
"gradient-ascent": 200,
"gradient-ascent-min-ensemble": 200,
"gradient-ascent-mean-ensemble": 200,
"mins": 0,
"reinforce": 200
}
baseline_to_scores = {
"autofocused-cbas": [],
"cbas": [],
"bo-qei": [],
"cma-es": [],
"gradient-ascent": [],
"gradient-ascent-min-ensemble": [],
"gradient-ascent-mean-ensemble": [],
"mins": [],
"reinforce": []
}
min_num_samples = 128
for baseline in baselines:
solutions = glob.glob(f"/home/btrabucco/final-results"
f"/{baseline}-nas/*/*/data/solution.npy")
for soln in solutions:
data = np.load(soln)
if data.shape == (128, 64, 4):
data = task.to_integers(task.denormalize_x(data))
data = ["-".join(row.tolist()) for row in data]
baseline_to_scores[baseline].append([
final_output[row] for row in data if row in final_output])
print(baseline, ':', baseline_to_scores[baseline])