Simulator_Bandits.py
def simulate(self, simulations, timesteps, arm_count, Algorithm):
        """ Simulates the algorithm over 'simulations' epochs """
        sum_regrets = np.zeros(timesteps)
        for e in range(simulations):
            bandit = Bandit.Bandit(arm_count)
            algo = Algorithm(bandit)
            regrets = np.zeros(timesteps)
            for i in range(timesteps):
                action = algo.get_action()
                reward, regret = algo.get_reward_regret(action)
                regrets[i] = regret
                sum_regrets += regrets  
        mean_regrets = sum_regrets / simulations
        return mean_regrets
 Simulates the algorithm over 'simulations' epochs 
Simulates the algorithm over 'simulations' epochs
Simulates the algorithm over ' simulations ' epochs
def simulate(self, simulations, timesteps, arm_count, Algorithm):
        sum_regrets = np.zeros(timesteps)
        for e in range(simulations):
            bandit = Bandit.Bandit(arm_count)
            algo = Algorithm(bandit)
            regrets = np.zeros(timesteps)
            for i in range(timesteps):
                action = algo.get_action()
                reward, regret = algo.get_reward_regret(action)
                regrets[i] = regret
                sum_regrets += regrets  
        mean_regrets = sum_regrets / simulations
        return mean_regrets
def simulate ( self , simulations , timesteps , arm_count , Algorithm ) : sum_regrets = np . zeros ( timesteps ) for e in range ( simulations ) : bandit = Bandit . Bandit ( arm_count ) algo = Algorithm ( bandit ) regrets = np . zeros ( timesteps ) for i in range ( timesteps ) : action = algo . get_action ( ) reward , regret = algo . get_reward_regret ( action ) regrets [ i ] = regret sum_regrets += regrets mean_regrets = sum_regrets / simulations return mean_regrets
Simulates the algorithm over 'simulations' epochs
Simulates the algorithm over ' simulations ' epochs
""" Simulates the algorithm over 'simulations' epochs """
self
simulations
timesteps
arm_count
Algorithm