示例#1
0
    def test_mab_run_many_arms(self):

        mab = MultiArmedBandit(k=100, t=10**6)

        mab.run_bandit_algorithm()

        # With many arms, we don't analyse pulls of sub-optimal arms.
        mab.analyse_regret()
        mab.print_performance()
        mab.plot_regret()

        mab.ph.show_plots()
示例#2
0
    def run(self):

        for i in range(self.total_experiment_count):
            self.logger.debug("MAB instance {0}".format(i))

            mab = None
            mab = MultiArmedBandit(k=self.arms_count_k, t=self.arm_pulls_n)
            mab.set_algorithms(self.algorithms_to_run)
            mab.run_bandit_algorithm()
            mab.analyse_regret()

            self.update_average_regrets(mab)
            self.current_experiment_count = self.current_experiment_count + 1
示例#3
0
    def test_mab_run(self):
        mab = MultiArmedBandit(k=5, t=10**4)

        algorithms_to_run = [("UCB1", UCB1), ("UCB-Inc", UCBIncremental),
                             ("UCB-Doub-TR",
                              UCBDoubling, mh.ucb_doubling_radius),
                             ("UCB-Doub", UCBDoubling)]

        mab.set_algorithms(algorithms_to_run)

        mab.run_bandit_algorithm()

        mab.analyse_regret()
        mab.analyse_suboptimal_arm_pulls()
        # mab.print_performance()
        mab.plot_suboptimal_arm()
        mab.plot_regret()

        mab.ph.show_plots()