Last active
August 29, 2015 14:21
-
-
Save springcoil/c673b19febe0fa157880 to your computer and use it in GitHub Desktop.
A Bayesian model for myself to debug - PyData Berlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_avg = pd.DataFrame({'avg_att': atts.stats()['mean'], | |
'avg_def': defs.stats()['mean']}, | |
index=teams.team.values) | |
df_avg = pd.merge(df_avg, df_observed, left_index=True, right_on='team', how='left') | |
fig, ax = plt.subplots(figsize=(8,6)) | |
for outcome in ['winner', 'triple_crown', 'wooden_spooon', '']: | |
ax.plot(df_avg.avg_att[df_avg.QR == outcome], | |
df_avg.avg_def[df_avg.QR == outcome], 'o', label=outcome) | |
for label, x, y in zip(df_avg.Team.values, df_avg.avg_att.values, df_avg.avg_def.values): | |
ax.annotate(label, xy=(x,y), xytext = (-5,5), textcoords = 'offset points') | |
ax.set_title('Attack vs Defense avg effect: 13-14 Six Nations') | |
ax.set_xlabel('Avg attack effect') | |
ax.set_ylabel('Avg defense effect') | |
ax.legend() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment