예제 #1
0
def test_predict():
    from reader import team_names, seasons
    names = team_names()
    s = seasons()
    season = s[0]
    predictions = Predictions(rate_elo( season))
    for i, ki in enumerate(predictions.teams):
        for j, kj in enumerate(predictions.teams):
            if i is j:
                continue
            print names[ki], names[kj], predictions[(ki, kj)]
예제 #2
0
def solve():
    from reader import seasons
    from elo_rater import predictions
    with open('data/submission.csv', 'w') as fn:
        fn.write('id,pred\n')
        for season in seasons()[-6:-1]:
            print season
            preds = predictions(season)
            for a,b,c in matchups(season):
                v = preds[(b,c)]
                fn.write('{0}_{1}_{2},{3}\n'.format(a,b,c,v))
예제 #3
0
def test_how_many_top_seed_overlaps():
    from reader import team_names, seasons
    names = team_names()
    seeds = data[4]
    s = seasons()
    regions = ['W', 'X', 'Y', 'Z']
    top_seeds = ['%s%02d' % (r, i) for r in regions for i in range(1,4)]
    print top_seeds
    for season in s:
        print season
        season_seeds =seeds[(seeds.season == season)]
        print season_seeds.shape[0]
        for j, y in season_seeds.iterrows():
            if y['seed'] in top_seeds:
                print names[y['team']], y['seed']
        for k,v in sorted(rate_elo(season).items(), key=lambda x: x[1], reverse=True)[:10]:
            print names[k], v