-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathperformance_calculator.py
84 lines (73 loc) · 2.18 KB
/
performance_calculator.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
'''
This script was used to calculate/generate the performance table.
To use it follow steps 1-4.
'''
'''
#
# Step 1: Enter your results
#
'''
results = {
'Random' : -1.175555412,
'Vector + LSTM' : 0.8806,
'Vector + FF' : -1.0,
'CameraOnly + our + FF' : -1.0,
'CameraOnly + our + LSTM' : -0.01368,
'CameraOnly + conv + FF' : -1.0,
'CameraOnly + conv + LSTM' : 0.1332,
'CameraSpeed + our + FF' : -1.0,
'CameraSpeed + our + LSTM' : -1.0,
'CameraSpeed + conv + FF' : -1.0,
'CameraSpeed + conv + LSTM' : -1.0,
}
'''
#
# Step 2: tell if you want latex-format, and if you want something printed between the entries.
#
'''
print_latex_table = False
latex_line_separator = '' #use '\\hline' to have a line between all entries
'''
#
# Step 3: Decide lower and an upper baseline.
#
'''
lower = results['Random']
upper = results['Vector + LSTM']
'''
#
# Step 4: Run the script!
#
'''
#####
##### Just code below . . .
#####
if not print_latex_table:
for name in sorted(results):
value = results[name]
relative = 100 * (value - lower) / (upper - lower)
print( "{:30}\t\t{}\t{}%".format(name,round(value,2),round(relative,2)) )
else:
best_val = sorted(results.items(), key=lambda x:x[1], reverse=True)[0][1]
print(
"""\\begin{table}[H]
\\begin{center}
\\begin{tabular}{||l | c| c ||}
\\hline
\\textbf{Model} & Reward & Percentage \\\\ [0.5ex]
\\hline\\hline"""
)
for name in sorted(results):
value = results[name]
relative = 100 * (value - lower) / (upper - lower)
if value == best_val:
print( "{:30} & \\textbf{{{}}} & \\textbf{{{}}}\\% \\\\ {}".format(name,round(value,2),round(relative,2), latex_line_separator) )
print( "{:30} & {} & {}\\% \\\\ {}".format(name,round(value,2),round(relative,2), latex_line_separator) )
print(
'''\\hline
\\end{tabular}
\\end{center}
\\caption{Results of the different configurations.}
\\label{results}
\\end{table}'''
)