Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # THOMPSON SAMPLING
- horizon <- 1000L
- simulations <- 1000L
- conversionProbabilities <- c(0.05, 0.10, 0.15, 0.20, 0.25)
- bandit <- BasicBernoulliBandit$new(weights = conversionProbabilities)
- policy <- ThompsonSamplingPolicy$new(alpha = 1, beta = 1)
- agent <- Agent$new(policy, bandit)
- historyThompson <- Simulator$new(agent, horizon, simulations)$run()
- plot(historyThompson, type = "arms",
- legend_labels = c('Ad 1', 'Ad 2', 'Ad 3', 'Ad 4', 'Ad 5'),
- legend_title = 'Thompson Sampling',
- legend_position = "topright",
- smooth = TRUE)
- summary(historyThompson)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement