N armed bandit simulation

August 2, 2013

As i learn more and more about machine learning and AI algorithms in general, i came across this book by Sutton & Barto, which is all about reinforcement learning. As i read through the action-value topic, it seemed a nice R-challenge, so here’s the complete code:

To test one greedy player and two epsilon players, for example, just run

 do.simulation(N = 500, plays = 1000, eps = c(0, 0.01, 0.1)) 

A quick explanation of some key parameters:

  • N: the number of replications for each simulation
  • plays: the number of moves for each player
  • eps: the probability of make a exploratory (random) move, for each player

That’s it, any comments or improvements are welcome, enjoy it!

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.