This commit is contained in:
wJsJwr 2018-10-13 12:12:52 +08:00
parent 8c6591bf27
commit f36f3ae836
6 changed files with 30 additions and 29 deletions

View File

@ -125,14 +125,14 @@ class Eid:
:param p: PID
:returns: an average value and a detail dict
"""
r += 1
ans = {}
sigma = 0.0
for p in self.survivals[m.name][str(r)]:
u, v = self.getVictims(m, r, p)
if u > 0:
e = max(0, min(1440, self.getTR2(m, r, p, self.getNeighborhood(m, r, p), v))) - u
ans[p] = e
sigma += e
u, v = self.getVictims2(m, r, p)
e = max(0, min(1440, self.getNeighborTR(m, r, p, self.getNeighborhood(m, r, p), v))) - u
ans[p] = e
sigma += e
return (sigma, ans)
def calc(self):
@ -143,7 +143,7 @@ class Eid:
for m in self.seasonClassic.data:
d = {}
maxr = int(m.query('game', 'created').first()['info']['game_end_at'])
for r in range(1, maxr+1):
for r in range(1, maxr):
sigma, ans = self.calcRoundData(m, r)
d[r] = ans
avgC[r-1] += sigma
@ -158,7 +158,7 @@ class Eid:
for m in self.seasonSurvive.data:
d = {}
maxr = int(m.query('game', 'created').first()['info']['game_end_at'])
for r in range(1, maxr+1):
for r in range(1, maxr):
sigma, ans = self.calcRoundData(m, r)
d[r] = ans
avgS[r-1] += sigma

View File

@ -16,16 +16,16 @@ def p1(x, coopr, e, postfix, show=True):
ax.set_ylim(0, 1)
ax.set_yticks(sp.linspace(0, 1, 5))
ax2 = ax.twinx()
ax2.plot(x[1:], e[1:], color=red, linewidth=2, label=r"$E_{i,D}$")
# ax2.set_ylim(0, 1440)
# ax2.set_yticks(sp.linspace(0, 1440, 5))
ax2.tick_params(labelsize=18)
ax.tick_params(labelsize=18)
ax2.plot(x[:-1], e[:-1], color=red, linewidth=2, label=r"$E_{i,D}$")
ax2.set_ylim(-1500, 200)
ax2.set_yticks(sp.linspace(-1500, 200, 5))
ax2.tick_params(labelsize=14)
ax.tick_params(labelsize=14)
ax.set_xlim(1, 15)
ax.set_xlabel("Rounds", size=22)
ax.set_ylabel(r"$f_c$", family='sans-serif', color=blue, size=22)
ax.tick_params(axis='y', labelcolor=blue)
ax2.set_ylabel(r"$E_{i,D}$", family='sans-serif', color=red, size=22)
ax2.set_ylabel(r"$TtD$", family='sans-serif', color=red, size=22)
ax2.tick_params(axis='y', labelcolor=red)
plt.tight_layout()
@ -49,7 +49,7 @@ def p2(e, coopr, postfix, show=True, showline=True):
plt.plot(fx,f1(fx),linewidth=2,color=red, ls='--', zorder=0)
plt.scatter(e, coopr, color='white', edgecolors=blue, linewidths=2, zorder=101)
ax.set_xlabel(r'$E_{i,D}$', family='sans-serif', size=20)
ax.set_xlabel(r'$TtD$', family='sans-serif', size=20)
ax.set_ylabel(r'$f_{c}$', family='sans-serif', size=20)
# ax.set_xlim(0, 1440)
# ax.set_xticks(sp.linspace(int(min(e)*0.9), int(max(e)*1.1), 4))
@ -77,9 +77,9 @@ def plot(mode, show, isp1):
p1(x, coopr, e, mode, show)
else:
if mode == 'SURVIVE':
p2(e[1:12], coopr[1:12], mode, show)
p2(e[:-1], coopr[:-1], mode, show)
else:
p2c(e[1:], coopr[1:], mode, show)
p2c(e[:-1], coopr[:-1], mode, show)
if __name__ == '__main__':
# eid_plot c/s 1/2 t/f
@ -90,17 +90,13 @@ if __name__ == '__main__':
"""
SURVIVE
残差 [ 0.10769174]
Model parameter: [ 1.33390242e-04 7.29761895e-01]
Other parameters: rank=2, sv=[ 1.37254846 0.34075025], rcond=3.33066907388e-15
error= 0.107692
pearson: 0.709599, p-value: 0.003045
残差 [ 0.06081364]
Model parameter: [ -3.54739130e-04 4.41956696e-01]
Other parameters: rank=2, sv=[ 1.40523958 0.15906514], rcond=3.10862446895e-15
error= 0.060814
pearson: -0.837958, p-value: 0.000183
CLASSIC
残差 [ 0.00992721]
Model parameter: [ 3.14661037e-05 7.35284315e-01]
Other parameters: rank=2, sv=[ 1.41231835 0.07319068], rcond=3.33066907388e-15
error= 0.009927
pearson: 0.309326, p-value: 0.261915
pearson: 0.384519, p-value: 0.174626
"""

View File

@ -74,9 +74,14 @@ class Solution:
if r['a'] not in previous_round_partner:
new_partner_succ += 1
su_after[is_coop] += new_partner_succ
t,v = 0,0
for i, _ in enumerate(su_after):
print(su_after[i], re_after[i], su_after[i] / re_after[i])
t += re_after[i]
v += su_after[i]
su_after[i] /= re_after[i]
print(v, t, v/t)
return su_after

View File

@ -1 +1 @@
0.0,-965.647058824,-1052.30769231,-1074.92957746,-944.262295082,-884.571428571,-1140.0,-1143.52941176,-1188.57142857,-1249.41176471,-1047.27272727,-1097.14285714,-1200.0,-1260.0,-1440.0
108.837209302,-33.488372093,-66.976744186,8.37209302326,-64.1860465116,-78.1395348837,-61.3953488372,-29.3023255814,-118.604651163,-127.741935484,-198.445229682,-110.769230769,-176.115107914,-564.705882353,0.0

1 108.837209302 -965.647058824 -33.488372093 -1052.30769231 -66.976744186 -1074.92957746 8.37209302326 -944.262295082 -64.1860465116 -884.571428571 -78.1395348837 -1140.0 -61.3953488372 -1143.52941176 -29.3023255814 -1188.57142857 -118.604651163 -1249.41176471 -127.741935484 -1047.27272727 -198.445229682 -1097.14285714 -110.769230769 -1200.0 -176.115107914 -1260.0 -564.705882353 -1440.0 0.0

View File

@ -1 +1 @@
0.0,-944.835294118,-790.169230769,-551.851851852,-1107.69230769,-1280.0,-960.0,-1440.0,-1440.0,-1440.0,0.0,0.0,0.0,-411.428571429,-1440.0
-737.628803245,-800.8735363,-1231.79775281,-1322.91139241,-1377.45454545,-1382.1686747,-1373.72384937,-1433.71179039,-1426.54205607,-1408.92086331,-1440.0,-1440.0,-600.0,-1440.0,0.0

1 -737.628803245 -944.835294118 -800.8735363 -790.169230769 -1231.79775281 -551.851851852 -1322.91139241 -1107.69230769 -1377.45454545 -1280.0 -1382.1686747 -960.0 -1373.72384937 -1433.71179039 -1426.54205607 -1408.92086331 0.0 -1440.0 0.0 -1440.0 0.0 -600.0 -411.428571429 -1440.0 -1440.0 0.0

File diff suppressed because one or more lines are too long