forked from dmu1981/mpt_tracking
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscorestatistics.py
More file actions
38 lines (31 loc) · 1.04 KB
/
scorestatistics.py
File metadata and controls
38 lines (31 loc) · 1.04 KB
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
import numpy as np
import seaborn
from matplotlib import pyplot as plt
import pandas
def print_score_statistics(scores, args, multiruns):
# Create an ordered list of teams
ordered = []
for team in scores.keys():
rmse = scores[team]["rmse"]
ordered.append((team, rmse))
# Sort them
ordered.sort(key=lambda x: x[1])
# Print (best team on top)
rmse_per_run = None
df = {}
for team, rmse in ordered:
bestRunIndex = np.argmin(scores[team]["rmse_per_run"])
worstRunIndex = np.argmax(scores[team]["rmse_per_run"])
if multiruns:
print(
f" {team:10}: {rmse:10.4} (Best run was index {bestRunIndex}, Worst run was index {worstRunIndex})"
)
else:
print(f" {team:10}: {rmse:10.4}")
df[team] = scores[team]["rmse_per_run"]
if args.debug and args.all is True:
df["indices"] = range(20)
df = pandas.DataFrame(df)
df.plot(x="indices", y=scores.keys(), kind="bar")
plt.show()
return ordered