def compare_scores(byus, bydarpa):
"""byus = { team: score }, bydarpa = { team: score }"""
assert frozenset(byus.keys()) == frozenset(bydarpa.keys())
our_ranking = ordered_sets(byus)
darpa_ranking = ordered_sets(bydarpa)
our_picks = our_ranking.values()[0]
darpa_picks = darpa_ranking.values()[0]
from scipy import stats
# scipy takes them as ordered lists
teamorder = list(byus.keys())
vals_us = [ byus[t] for t in teamorder ]
vals_darpa = [ bydarpa[t] for t in teamorder ]
tau, p_value = stats.kendalltau(vals_us, vals_darpa)
def names(teams_set):
return '[' + ' '.join(sorted(n.split()[0] for n in teams_set)) + ']'
if our_picks == darpa_picks:
print "[ ] All first choice(s)",names(our_picks),"match, excellent!"
elif our_picks.isdisjoint(darpa_picks):
print "[XX] Our first choice(s)",names(our_picks)," completely different from DARPA's",names(darpa_picks)
else:
print "[__] Partial match between our first choice(s) and DARPA's. Both have",names(darpa_picks&our_picks),"(we also have:",names(our_picks-darpa_picks)," -- darpa also has:",names(darpa_picks-our_picks),")"
print " FOR US:"
for score,teams in our_ranking.iteritems():
print " ","%+.4f"%score,names(teams)
print " DARPA:"
for score,teams in darpa_ranking.iteritems():
print " ","%+.4f"%score,names(teams)
print " %s Kendall tau: %.4f (p-value for being correlated: %.6f)" % (("<7" if tau < 0.7 else "<8") if tau < 0.8 else " ", tau, p_value)
reproduce_cqe_scores.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录