-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathre_ordering_hyper_result.py
65 lines (46 loc) · 1.18 KB
/
re_ordering_hyper_result.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
import numpy as np
# bpr_tuning_result_cm-100k
# bpr_tuning_result_kuai
# direct_tuning_result_cm-100k
# direct_tuning_result_kuai
# macr_tuning_result_cm-100k
# macr_tuning_result_kuai
# ssm_tuning_result_cm-100k
# ssm_tuning_result_kuai
name = 'ssm_tuning_result_kuai'
f = open("./%s"%(name), 'r')
lines = f.readlines()
hyper = []
valid = []
test = []
for i, line in enumerate(lines):
line = line.rstrip()
# line = line.split(",")
if i % 6 == 0:
hyper.append(line)
if i % 6 == 2:
valid.append(line)
if i % 6 == 4:
test.append(line)
f.close()
valid = np.asarray(valid)
test = np.asarray(test)
hyper = np.asarray(hyper)
for_sorting = []
for sss in valid:
line = sss.split(" ")
print(line[26])
for_sorting.append(float(line[26]))
sorted_index = np.argsort(for_sorting)
sorted_index = sorted_index[::-1]
valid = valid[sorted_index]
test = test[sorted_index]
hyper = hyper[sorted_index]
with open("./%s_re"%(name), 'w') as f:
for i, line in enumerate(valid):
line_str = line + "\t"
f.write(line_str)
line_str = test[i] + "\t"
f.write(line_str)
line_str = hyper[i] + "\n"
f.write(line_str)