forked from aisobran/Adv-ML-NFL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoring.py
31 lines (22 loc) · 801 Bytes
/
scoring.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
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import glob
#files = glob.glob("annResults/testAcc/*.txt")
files = glob.glob("annResults/t7/*.txt")
for file in files:
#year = file.split(".")[0].split("testAccuracy")[1]
year = file.split(".")[0].split("/").pop()
table = pd.read_csv(file, names=["Team", "Test", "Train", "Tend"])
N = len(table["Team"])
ind = np.arange(N)
width = 0.35
score = (table["Test"] - table["Tend"]) * 100
fig, ax = plt.subplots()
fig.set_size_inches(18.5 * 0.9, 10.5 * 0.9)
rects1 = ax.bar(ind, score, width, color='r')
ax.set_ylabel('Score')
ax.set_title('Score - ' + year)
ax.set_xticks(ind + (width * 0.5))
ax.set_xticklabels(table["Team"])
plt.savefig("annResults/t7/scoring/" + year + '.png', bbox_inches='tight', dpi=100)