new theta

This commit is contained in:
wjsjwr 2022-07-25 21:49:26 +08:00
parent f7bd06f58c
commit cc58480c04
9 changed files with 24 additions and 15 deletions

View File

@ -1 +1 @@
1221.2386363636363,1163.7443181818182,1186.4147727272727,1163.4943181818182,1170.2670454545455,1144.4943181818182,1050.6761363636363,1182.8125,1070.0568181818182,1123.6931818181818,1240.5738636363637,1161.4488636363637,1203.4941176470588,0.0,0.0,0.0 1191.0056818181818,1216.3522727272727,1152.0625,1174.596590909091,1138.0397727272727,1154.2386363636363,1136.653409090909,1043.6306818181818,1175.3125,1062.5568181818182,1109.375,1223.6420454545455,1146.8693181818182,1195.0235294117647,0.0,0.0

1 1221.2386363636363 1191.0056818181818 1163.7443181818182 1216.3522727272727 1186.4147727272727 1152.0625 1163.4943181818182 1174.596590909091 1170.2670454545455 1138.0397727272727 1144.4943181818182 1154.2386363636363 1050.6761363636363 1136.653409090909 1182.8125 1043.6306818181818 1070.0568181818182 1175.3125 1123.6931818181818 1062.5568181818182 1240.5738636363637 1109.375 1161.4488636363637 1223.6420454545455 1203.4941176470588 1146.8693181818182 1195.0235294117647 0.0 0.0 0.0

View File

@ -1 +1 @@
1435.4651162790697,1425.843023255814,1429.9883720930231,1429.0697674418604,1435.5755813953488,1427.6744186046512,1431.9011627906978,1434.0755813953488,1433.7093023255813,1433.7209302325582,1432.9941860465117,1438.953488372093,1427.6744186046512,1436.551724137931,1431.7241379310344,0.0 1283.093023255814,1227.2209302325582,1192.5116279069769,1209.8488372093022,1267.5523255813953,1283.5232558139535,1284.0813953488373,1305.1744186046512,1294.1976744186047,1322.5232558139535,1335.6802325581396,1326.1627906976744,1371.8081395348838,1350.3023255813953,1401.5747126436781,1405.2413793103449

1 1435.4651162790697 1283.093023255814 1425.843023255814 1227.2209302325582 1429.9883720930231 1192.5116279069769 1429.0697674418604 1209.8488372093022 1435.5755813953488 1267.5523255813953 1427.6744186046512 1283.5232558139535 1431.9011627906978 1284.0813953488373 1434.0755813953488 1305.1744186046512 1433.7093023255813 1294.1976744186047 1433.7209302325582 1322.5232558139535 1432.9941860465117 1335.6802325581396 1438.953488372093 1326.1627906976744 1427.6744186046512 1371.8081395348838 1436.551724137931 1350.3023255813953 1431.7241379310344 1401.5747126436781 0.0 1405.2413793103449

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
1221.2386363636363,1163.7443181818182,1186.4147727272727,1163.4943181818182,1170.2670454545455,1144.4943181818182,1050.6761363636363,1182.8125,1070.0568181818182,1123.6931818181818,1240.5738636363637,1161.4488636363637,1203.4941176470588,0.0,0.0,0.0 1191.0056818181818,1216.3522727272727,1152.0625,1174.596590909091,1138.0397727272727,1154.2386363636363,1136.653409090909,1043.6306818181818,1175.3125,1062.5568181818182,1109.375,1223.6420454545455,1146.8693181818182,1195.0235294117647,0.0,0.0

1 1221.2386363636363 1191.0056818181818 1163.7443181818182 1216.3522727272727 1186.4147727272727 1152.0625 1163.4943181818182 1174.596590909091 1170.2670454545455 1138.0397727272727 1144.4943181818182 1154.2386363636363 1050.6761363636363 1136.653409090909 1182.8125 1043.6306818181818 1070.0568181818182 1175.3125 1123.6931818181818 1062.5568181818182 1240.5738636363637 1109.375 1161.4488636363637 1223.6420454545455 1203.4941176470588 1146.8693181818182 1195.0235294117647 0.0 0.0 0.0

View File

@ -1 +1 @@
1435.4651162790697,1425.843023255814,1429.9883720930231,1429.0697674418604,1435.5755813953488,1427.6744186046512,1431.9011627906978,1434.0755813953488,1433.7093023255813,1433.7209302325582,1432.9941860465117,1438.953488372093,1427.6744186046512,1436.551724137931,1431.7241379310344,0.0 1283.093023255814,1227.2209302325582,1192.5116279069769,1209.8488372093022,1267.5523255813953,1283.5232558139535,1284.0813953488373,1305.1744186046512,1294.1976744186047,1322.5232558139535,1335.6802325581396,1326.1627906976744,1371.8081395348838,1350.3023255813953,1401.5747126436781,1405.2413793103449

1 1435.4651162790697 1283.093023255814 1425.843023255814 1227.2209302325582 1429.9883720930231 1192.5116279069769 1429.0697674418604 1209.8488372093022 1435.5755813953488 1267.5523255813953 1427.6744186046512 1283.5232558139535 1431.9011627906978 1284.0813953488373 1434.0755813953488 1305.1744186046512 1433.7093023255813 1294.1976744186047 1433.7209302325582 1322.5232558139535 1432.9941860465117 1335.6802325581396 1438.953488372093 1326.1627906976744 1427.6744186046512 1371.8081395348838 1436.551724137931 1350.3023255813953 1431.7241379310344 1401.5747126436781 0.0 1405.2413793103449

File diff suppressed because one or more lines are too long

BIN
outputs/theta_plot_new.pdf Normal file

Binary file not shown.

View File

@ -7,13 +7,13 @@ red = '#d63031'
MAX_ROUND = 16 # = game_end_at + 1 MAX_ROUND = 16 # = game_end_at + 1
x = np.arange(1, MAX_ROUND+1) x = np.arange(1, MAX_ROUND+1)
tc = np.loadtxt("outputs/EID_NEW_BA.csv", delimiter=',') tc = np.loadtxt("outputs/THETA_NEW_BA.csv", delimiter=',')
ts = np.loadtxt("outputs/EID_NEW_WS.csv", delimiter=',') ts = np.loadtxt("outputs/THETA_NEW_WS.csv", delimiter=',')
fig = plt.figure(figsize=(6,4.5)) fig = plt.figure(figsize=(6,4.5))
ax = fig.gca() ax = fig.gca()
ax.plot(x[:-3], tc[:-3], 'o--', color='limegreen', linewidth=2, label=r"BA") ax.plot(x[:-2], tc[:-2], 'o--', color='limegreen', linewidth=2, label=r"BA")
ax.plot(x[:-1], ts[:-1], 'o-', color='darkorange', linewidth=2, label=r"WS") ax.plot(x, ts, 'o-', color='darkorange', linewidth=2, label=r"WS")
# ax.set_ylim(-1500, 500) # ax.set_ylim(-1500, 500)
# ax.set_yticks(sp.linspace(-1500, 500, 6)) # ax.set_yticks(sp.linspace(-1500, 500, 6))

View File

@ -51,7 +51,15 @@ class theta_r_i:
:param s: Survivals list(neighborhood) :param s: Survivals list(neighborhood)
:returns: theta_{r}_{i} :returns: theta_{r}_{i}
""" """
return 1440*len(s) - reduce(lambda a, b: a + b['tr'], m.query('action', 'done').where(lambda x: x['rno'] == r and ((x['a'] in s)or(x['b']in s))).raw_data, 0) actions = m.query('action', 'done')\
.where(lambda x: x['rno'] == r and ((x['a'] in s)or(x['b']in s)))\
.raw_data
def reduce_func(total, item):
if item['a'] in s and item['b'] in s:
return total + item['tr'] * 2
return total + item['tr']
return 1440*len(s) - reduce(reduce_func, actions, 0)
def getNeighborhood(self, m, r, p): def getNeighborhood(self, m, r, p):
@ -95,9 +103,9 @@ class theta_r_i:
cnt = np.zeros(MAX_ROUND) cnt = np.zeros(MAX_ROUND)
for m in season.data: for m in season.data:
d = {} d = {}
maxr = int(m.query('game', 'created').first()['info']['game_end_at']) game_end_at = int(m.query('game', 'created').first()['info']['game_end_at'])
for r in range(1, maxr): for r in range(1, game_end_at + 1):
sigma, ans = self.calcRoundData(m, r) sigma, ans = self.calcRoundData(m, r - 1)
d[r] = ans d[r] = ans
avg[r-1] += sigma avg[r-1] += sigma
cnt[r-1] += len(ans) cnt[r-1] += len(ans)
@ -107,14 +115,14 @@ class theta_r_i:
if cnt[i] == 0: if cnt[i] == 0:
cnt[i] = 1 cnt[i] = 1
avg /= cnt avg /= cnt
with open(f'outputs/EID_{name}.csv', 'w') as f: with open(f'outputs/THETA_{name}.csv', 'w') as f:
csv.writer(f).writerow(avg) csv.writer(f).writerow(avg)
return avg return avg
def calc(self): def calc(self):
for s in self.seasons: for s in self.seasons:
self.calc_season(s['season'], s['name']) self.calc_season(s['season'], s['name'])
with open('outputs/EID_new_detail.json', 'w') as f: with open('outputs/THETA_new_detail.json', 'w') as f:
json.dump(self.details, f) json.dump(self.details, f)
if __name__ == '__main__': if __name__ == '__main__':