示例#1
0
def main(unused_arg):
    # Construct meta-game payoff tables
    # payoff_tables = get_kuhn_poker_data()

    payoff_tables = [
        np.array([[1.1, -10.0], [1.0, -1.0], [-1.0, 1.0]]),
        np.array([[-1.1, 10.0], [-1.0, 1.0], [1.0, -1.0]])
    ]

    payoffs_are_hpt_format = utils.check_payoffs_are_hpt(payoff_tables)
    strat_labels = utils.get_strat_profile_labels(payoff_tables,
                                                  payoffs_are_hpt_format)

    # Run AlphaRank

    rhos, rho_m, pi, _, _ = alpharank.compute(payoff_tables, alpha=1e1)

    # Report & plot results
    alpharank.print_results(payoff_tables,
                            payoffs_are_hpt_format,
                            rhos=rhos,
                            rho_m=rho_m,
                            pi=pi)
    utils.print_rankings_table(payoff_tables, pi, strat_labels)
    m_network_plotter = alpharank_visualizer.NetworkPlot(payoff_tables,
                                                         rhos,
                                                         rho_m,
                                                         pi,
                                                         strat_labels,
                                                         num_top_profiles=8)
    m_network_plotter.compute_and_draw_network()
示例#2
0
    # Import the csv
    df = pd.read_csv(csv_path, index_col=False)

    # Convert to payoff_tables
    payoff_tables, strat_labels = payoff_tables_from_df(df)
    # payoff_tables = heuristic_payoff_table.from_elo_scores([1286, 1322, 1401, 1440, 1457, 1466, 1470])

    payoffs_are_hpt_format = utils.check_payoffs_are_hpt(payoff_tables)

    # strat_labels = utils.get_strat_profile_labels(payoff_tables(), payoffs_are_hpt_format)

    # Run AlphaRank
    rhos, rho_m, pi, _, _ = alpharank.compute(payoff_tables, alpha=1e-1)

    # Report & plot results
    alpharank.print_results(payoff_tables,
                            payoffs_are_hpt_format,
                            rhos=rhos,
                            rho_m=rho_m,
                            pi=pi)

    utils.print_rankings_table(payoff_tables, pi, strat_labels)

    m_network_plotter = alpharank_visualizer.NetworkPlot(payoff_tables,
                                                         rhos,
                                                         rho_m,
                                                         pi,
                                                         strat_labels,
                                                         num_top_profiles=7)
    m_network_plotter.compute_and_draw_network()
    # alpharank.sweep_pi_vs_alpha(payoff_tables, visualize=True)