生成场次单独数据

This commit is contained in:
wjsjwr 2022-07-25 23:30:10 +08:00
parent cc58480c04
commit 68d06e3f94
11 changed files with 21 additions and 6 deletions

View File

@ -27,13 +27,16 @@ def calcAndSave(mode, network_type=None):
times[r-1] += len(rows) * 2
cs[r-1] += coop
c[r - 1] = coop / (len(rows) * 2)
with open(f"outputs/CR_{m.name}.csv", 'w') as f:
csv.writer(f).writerow(c)
crs.append(c)
for i in range(MAX_ROUND):
if(times[i] == 0):
times[i] = 1
cs /= times
with open("outputs/CR_%s_%s.csv"%(mode, network_type), 'w') as f:
csv.writer(f).writerow(cs)
csv.writer(f).writerow(cs)
with open("outputs/CRAW_%s_%s.json"%(mode, network_type), 'w') as f:
json.dump(crs, f)

1
outputs/CR_G1142.csv Normal file
View File

@ -0,0 +1 @@
0.9274809160305344,0.8943089430894309,0.8925619834710744,0.8878504672897196,0.8773584905660378,0.8387096774193549,0.8333333333333334,0.8411764705882353,0.7658227848101266,0.8035714285714286,0.788235294117647,0.7352941176470589,0.689873417721519,0.6818181818181818
1 0.9274809160305344 0.8943089430894309 0.8925619834710744 0.8878504672897196 0.8773584905660378 0.8387096774193549 0.8333333333333334 0.8411764705882353 0.7658227848101266 0.8035714285714286 0.788235294117647 0.7352941176470589 0.689873417721519 0.6818181818181818

1
outputs/CR_G1156.csv Normal file
View File

@ -0,0 +1 @@
0.9329268292682927,0.926829268292683,0.845679012345679,0.8506493506493507,0.8287671232876712,0.8375,0.7608695652173914,0.8333333333333334,0.7954545454545454,0.7214285714285714,0.7578125,0.7622950819672131,0.6384615384615384,0.5819672131147541
1 0.9329268292682927 0.926829268292683 0.845679012345679 0.8506493506493507 0.8287671232876712 0.8375 0.7608695652173914 0.8333333333333334 0.7954545454545454 0.7214285714285714 0.7578125 0.7622950819672131 0.6384615384615384 0.5819672131147541

1
outputs/CR_G1162.csv Normal file
View File

@ -0,0 +1 @@
0.91015625,0.9217391304347826,0.9107142857142857,0.9030612244897959,0.8939393939393939,0.907608695652174,0.8764705882352941,0.8166666666666667,0.788235294117647,0.7528089887640449,0.65,0.5602409638554217,0.49375,0.30246913580246915,0.29411764705882354,0.23026315789473684
1 0.91015625 0.9217391304347826 0.9107142857142857 0.9030612244897959 0.8939393939393939 0.907608695652174 0.8764705882352941 0.8166666666666667 0.788235294117647 0.7528089887640449 0.65 0.5602409638554217 0.49375 0.30246913580246915 0.29411764705882354 0.23026315789473684

1
outputs/CR_G975.csv Normal file
View File

@ -0,0 +1 @@
0.9038461538461539,0.831081081081081,0.8066666666666666,0.7246376811594203,0.7578125,0.7236842105263158,0.7364864864864865,0.7121212121212122,0.7071428571428572,0.717948717948718,0.6890243902439024,0.75,0.753968253968254
1 0.9038461538461539 0.831081081081081 0.8066666666666666 0.7246376811594203 0.7578125 0.7236842105263158 0.7364864864864865 0.7121212121212122 0.7071428571428572 0.717948717948718 0.6890243902439024 0.75 0.753968253968254

1
outputs/THETA_G1142.csv Normal file
View File

@ -0,0 +1 @@
1373.894117647059,1319.9058823529413,1202.3647058823528,1164.3294117647058,1206.5529411764705,1283.3647058823528,1248.070588235294,1352.6941176470589,1260.964705882353,1303.4235294117648,1241.964705882353,1302.5882352941176,1362.0823529411764,1339.6705882352942
1 1373.894117647059 1319.9058823529413 1202.3647058823528 1164.3294117647058 1206.5529411764705 1283.3647058823528 1248.070588235294 1352.6941176470589 1260.964705882353 1303.4235294117648 1241.964705882353 1302.5882352941176 1362.0823529411764 1339.6705882352942

1
outputs/THETA_G1156.csv Normal file
View File

@ -0,0 +1 @@
1080.7411764705882,1052.1176470588234,1071.270588235294,1080.5882352941176,1015.5294117647059,1085.4352941176471,1048.8823529411766,856.6705882352941,1120.7058823529412,954.1529411764706,1081.1764705882354,1222.7764705882353,1027.929411764706,1195.0235294117647
1 1080.7411764705882 1052.1176470588234 1071.270588235294 1080.5882352941176 1015.5294117647059 1085.4352941176471 1048.8823529411766 856.6705882352941 1120.7058823529412 954.1529411764706 1081.1764705882354 1222.7764705882353 1027.929411764706 1195.0235294117647

1
outputs/THETA_G1162.csv Normal file
View File

@ -0,0 +1 @@
1194.3793103448277,1136.6666666666667,1182.8850574712644,1254.3218390804598,1327.1494252873563,1283.6781609195402,1319.2643678160919,1258.7471264367816,1326.6666666666667,1341.183908045977,1427.2413793103449,1349.1954022988505,1381.3103448275863,1360.6896551724137,1401.5747126436781,1405.2413793103449
1 1194.3793103448277 1136.6666666666667 1182.8850574712644 1254.3218390804598 1327.1494252873563 1283.6781609195402 1319.2643678160919 1258.7471264367816 1326.6666666666667 1341.183908045977 1427.2413793103449 1349.1954022988505 1381.3103448275863 1360.6896551724137 1401.5747126436781 1405.2413793103449

1
outputs/THETA_G975.csv Normal file
View File

@ -0,0 +1 @@
1294.0,1369.7582417582419,1227.5274725274726,1262.4065934065934,1252.4725274725274,1218.5054945054944,1218.6373626373627,1218.2637362637363,1226.3186813186812,1163.8131868131868,1135.7142857142858,1224.4505494505495,1257.967032967033
1 1294.0 1369.7582417582419 1227.5274725274726 1262.4065934065934 1252.4725274725274 1218.5054945054944 1218.6373626373627 1218.2637362637363 1226.3186813186812 1163.8131868131868 1135.7142857142858 1224.4505494505495 1257.967032967033

View File

@ -26,6 +26,6 @@ ax.set_ylabel(r"$\theta$", family='sans-serif', size=22)
plt.legend(numpoints=2, fontsize=14)
plt.tight_layout()
# plt.show()
plt.show()
# plt.savefig("graph/theta_plot.eps")
plt.savefig("graph/theta_plot_new.pdf")
# plt.savefig("graph/theta_plot_new.pdf")

View File

@ -103,13 +103,17 @@ class theta_r_i:
cnt = np.zeros(MAX_ROUND)
for m in season.data:
d = {}
cur_game_avg = []
game_end_at = int(m.query('game', 'created').first()['info']['game_end_at'])
for r in range(1, game_end_at + 1):
sigma, ans = self.calcRoundData(m, r - 1)
d[r] = ans
sigma, detail = self.calcRoundData(m, r - 1)
d[r] = detail
avg[r-1] += sigma
cnt[r-1] += len(ans)
cnt[r-1] += len(detail)
cur_game_avg.append(sigma / len(detail))
self.details[m.name] = d
with open(f'outputs/THETA_{m.name}.csv', 'w') as f:
csv.writer(f).writerow(cur_game_avg)
print(cnt)
for i in range(MAX_ROUND):
if cnt[i] == 0: