Hi, Whilst on the way to clojure-conj I'd started reading a new O'Reilly book on Bandit Optimization[1] and thought I'd give myself the exercise of porting the algorithms to Clojure. It was really good fun to play with a problem in pure Clojure- I went from using protocols and atoms to just using records and functions (although a multi-method survived).
The code is available here: https://github.com/pingles/clj-bandit I know there are already libraries [2][3] that are specifically built for integrating into a web application but I wanted to focus on just the algorithms (and an accompanying monte-carlo simulator also implemented in the book). I'm pretty happy with the code but I think the coolest part was the simulator (https://github.com/pingles/clj-bandit/blob/master/src/clj_bandit/simulate.clj). The simulator lets us run the algorithm up to a specified horizon- the total number of pulls we'd like to make- we'd like to optimise our return by that point. By using clojure.core/iterate it was easy to model the simulation as a sequence- so you end up with the following: (take horizon (simulation-seq bandit (partial epsilon-greedy/select-arm epsilon-value) arms)) Anyway, I was planning on adding a complimentary library that provides Ring middleware + functions to make it easy to integrate the optimisation techniques into an app but I haven't had time. Rather than waiting until I'd written/started that I thought I'd mention this library here in case anyone else finds it interesting. Hopefully the upcoming holidays will give me a few days to write the extension library. Thanks to everyone for running clojure-conj- I thoroughly enjoyed it and the talks and conference motivated me to do some hacking in Clojure. Regards, Paul 1) http://shop.oreilly.com/product/0636920027393.do 2) https://github.com/ptaoussanis/touchstone 3) https://github.com/jeandenis/bestcase -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en