A Python/Flask REST API for the bandit algorithms. Uses redis under the hood.
Currently supports e-greedy and softmax action selection.
Each Bandit has up to 8 parameters associated with it. These include:
-
name
: Can be any string -
arm_count
: Must be a positive integer -
algo_type
: Only "egreedy" or "softmax" (will add more later) -
budget_type
: Only "trials" (will add more later) -
budget
: Must be a positive integer -
epsilon
: Must be a float between 0 and 1 -
temperature
: Must be a float between 0 and infinity -
reward_type
: Only "click" (will add more later)
$ curl -i -H "Content-Type: application/json" -X POST -d '{"name":"test","arm_count":4,"algo_type":"egreedy","budget_type":"trials", "budget":1000, "epsilon":0.1,"reward_type":"click"}' http://localhost:5000/api/v1.0/bandits
$ curl -i http://localhost:5000/api/v1.0/bandits/1
$ curl -i http://localhost:5000/api/v1.0/bandits/1/arms/current
$ curl -i -H "Content-Type: application/json" -X PUT -d '{"name":"test","algo_type":"egreedy","budget_type":"trials", "budget":1000, "epsilon":0.1}' http://localhost:5000/api/v1.0/bandits/1
For "click" reward type, reward must be either 0 (no click) or 1 (click)
$ curl -i -H "Content-Type: application/json" -X PUT -d '{"reward":1}' http://localhost:5000/api/v1.0/bandits/1/arms/1
$ curl -i -H "Content-Type: application/json" -X DELETE -d http://localhost:5000/api/v1.0/bandits/1