Created
July 17, 2017 15:56
-
-
Save FranciscusRenatus/a9f82a334fa56f54fd79584867331671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for n in range(0, N): | |
ad = 0 | |
max_random = 0 | |
for i in range(0, d): | |
random_beta = random.betavariate(numbers_of_rewards_1[i] + 1, numbers_of_rewards_0[i] + 1) | |
if random_beta > max_random: | |
max_random = random_beta | |
ad = i | |
ads_selected.append(ad) | |
reward = dataset.values[n, ad] | |
if reward == 1: | |
numbers_of_rewards_1[ad] = numbers_of_rewards_1[ad] + 1 | |
else: | |
numbers_of_rewards_0[ad] = numbers_of_rewards_0[ad] + 1 | |
total_reward = total_reward + reward |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment