Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. library(contextual)
  2.  
  3. # EPSILON GREEDY
  4. horizon <- 1000L
  5. simulations <- 1000L
  6. conversionProbabilities <- c(0.05, 0.10, 0.15, 0.20, 0.25)
  7.  
  8. bandit <- BasicBernoulliBandit$new(weights = conversionProbabilities)
  9. policy <- EpsilonGreedyPolicy$new(epsilon = 0.10)
  10. agent <- Agent$new(policy, bandit)
  11.  
  12. historyEG <- Simulator$new(agent, horizon, simulations)$run()
  13.  
  14. plot(historyEG, type = "arms",
  15. legend_labels = c('Ad 1', 'Ad 2', 'Ad 3', 'Ad 4', 'Ad 5'),
  16. legend_title = 'Epsilon Greedy',
  17. legend_position = "topright",
  18. smooth = TRUE)
  19.  
  20. summary(historyEG)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement