def team2_score(roster): cats, points, scores, _ = simulate_h2h(roster, team1.roster(week=week), num_days=num_days, num_samples=num_samples, week=week, decay_rate=decay_rate) return metric_fn(cats, points, scores, num_samples)
def roster_score(other_roster, num_days, num_samples, week, decay_rate, roster): cats, points, scores, _ = simulate_h2h(roster, other_roster, num_days=num_days, num_samples=num_samples, week=week, decay_rate=decay_rate) means = cats.mean(axis=1) table = [] probs = np.concatenate([ (cats[0, ..., :-1] > cats[1, ..., :-1]).mean(axis=0), (cats[0, ..., -1:] < cats[1, ..., -1:]).mean(axis=0), ]) for j, cat in enumerate(CATEGORY_NAMES): table.append([cat] + list(means[:, j]) + [probs[..., j]]) result = winning_prob(cats, points, scores, num_samples) return result