コード例 #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 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