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