-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_max.py
129 lines (106 loc) · 3.3 KB
/
get_max.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import sys
f = open('/data/sidana/recnet/param_tune/'+sys.argv[1]+'/recnet/results', 'r')
#f = open('/home/sumit/embcs/results', 'r')
flag_0_1 = False
flag_1_0 = False
flag_1_1 = False
map_01_1 = 0.0
map_01_5 = 0.0
map_01_10 = 0.0
map_10_1 = 0.0
map_10_5 = 0.0
map_10_10 = 0.0
map_11_1 = 0.0
map_11_5 = 0.0
map_11_10 = 0.0
param_line = ""
param_01_1 = ""
param_01_5 = ""
param_01_10 = ""
param_10_1 = ""
param_10_5 = ""
param_10_10 = ""
param_11_1 = ""
param_11_5 = ""
param_11_10 = ""
for line in f:
line = line.strip('\n')
if "Latent Factor" in line:
param_line = line
if line == "alpha: 0, beta: 1":
flag_0_1 = True
flag_1_1 = False
flag_1_0 = False
continue
if line == "alpha: 1, beta: 0":
flag_0_1 = False
flag_1_1 = False
flag_1_0 = True
continue
if line == "alpha: 1, beta: 1":
flag_0_1 = False
flag_1_1 = True
flag_1_0 = False
continue
if line[0:5] == "map@1" or line[0:5]== "map@5" or line[0:6]=="map@10":
line_value = float(line[7:])
# if line[0:6]=="map@10":
# print(line)
# print(line_value)
if flag_0_1:
if "map@10" in line:
if line_value > map_01_10:
param_01_10 = param_line
map_01_10 = line_value
continue
if "map@1" in line:
if line_value > map_01_1:
param_01_1 = param_line
map_01_1 = line_value
continue
if "map@5" in line:
if line_value > map_01_5:
param_01_5 = param_line
map_01_5 = line_value
continue
if flag_1_0:
if "map@10" in line:
if line_value > map_10_10:
param_10_10 = param_line
map_10_10 = line_value
continue
if "map@1" in line:
if line_value > map_10_1:
param_10_1 = param_line
map_10_1 = line_value
continue
if "map@5" in line:
if line_value > map_10_5:
param_10_5 = param_line
map_10_5 = line_value
continue
if flag_1_1:
if "map@10" in line:
if line_value > map_11_10:
param_11_10 = param_line
map_11_10 = line_value
continue
if "map@1" in line:
if line_value > map_11_1:
param_11_1 = param_line
map_11_1 = line_value
continue
if "map@5" in line:
if line_value > map_11_5:
param_11_5 = param_line
map_11_5 = line_value
continue
print('map_01_1: '+ str(map_01_1)+' for parameters:'+str(param_01_1))
print('map_01_5: ' + str(map_01_5)+' for parameters:'+str(param_01_5))
print('map_01_10:'+ str(map_01_10)+' for parameters:'+str(param_01_10))
print('map_10_1: ' + str(map_10_1)+' for parameters:'+str(param_10_1))
print('map_10_5: ' + str(map_10_5)+' for parameters:'+str(param_10_5))
print('map_10_10:'+ str(map_10_10)+' for parameters:'+str(param_10_10))
print('map_11_1: '+str(map_11_1)+' for parameters:'+str(param_11_1))
print('map_11_5: '+str(map_11_5)+' for parameters:'+str(param_11_5))
print('map_11_10:'+str(map_11_10)+' for parameters:'+str(param_11_10))