コード例 #1
0
    def print_matchups(self, champion_names):
        for champion_a in sorted(self.matchup_play_counts.iterkeys()):
            for role, _ in utilities.most_common_percent(self.play_counts[champion_a], 0.9):
                role_played = self.play_counts[champion_a][role]
                role_won = self.win_counts[champion_a][role]

                independent_prob = role_won / float(role_played)
                independent_std = utilities.binomial_stddev(independent_prob, role_played)

                print "{} {} [{:.1f}% +/- {:.1f}%]".format(champion_names[champion_a], role, 100. * independent_prob, 100. * independent_std)

                for champion_b, num_played in utilities.most_common_percent(self.matchup_play_counts[champion_a][role], 0.9):
                    num_wins = self.matchup_win_counts[champion_a][role][champion_b]
                    p = num_wins / float(num_played)
                    std = utilities.binomial_stddev(p, num_played)

                    other_ind_played = self.play_counts[champion_b][role]
                    other_ind_won = self.win_counts[champion_b][role]

                    other_ind_prob = other_ind_won / float(other_ind_played)

                    avg_prob = (independent_prob + 1. - other_ind_prob) / 2

                    print "\tvs {:20s}: {:.1f}% +/- {:.1f}% in {:6,} games. z={:+3f}. IndP={:.1f}%".format(champion_names[champion_b],
                                                                         100. * p,
                                                                         100. * std,
                                                                         num_played,
                                                                         (p - independent_prob) / std,
                                                                         100. * avg_prob)
コード例 #2
0
    def print_roles(self, champion_names):
        print "What percent of games match the standard 5 roles? {:.1f}%".format(100. * self.role_matches[True] / sum(self.role_matches.values()))
        print "What percent of roles have a matchup? {:.1f}%".format(100. * self.role_matchups[True] / sum(self.role_matchups.values()))
        print "Champion stats by role"
        for champion_id in sorted(self.play_counts.iterkeys()):
            print "{} [{}]".format(champion_names[champion_id], champion_id)

            for role, count in utilities.most_common_percent(self.play_counts[champion_id], 0.9):
                print "\t{:20s}: {:.1f}% win rate out of {:,} games played".format(role,
                    100. * self.win_counts[champion_id][role] / self.play_counts[champion_id][role], self.play_counts[champion_id][role])