Skip to content

Instantly share code, notes, and snippets.

View WuXinyang2012's full-sized avatar
🎯
Focusing

Wu Xinyang WuXinyang2012

🎯
Focusing
  • Stuttgart, Germany.
View GitHub Profile
@stucchio
stucchio / bayes_bandit_empirical_gain_from_incorporating_priors.py
Created April 28, 2013 22:17
Empirical gain from incorporating priors into the Bayesian Bandit
from numpy import *
from scipy.stats import beta
import random
class BetaBandit(object):
def __init__(self, num_options=2, prior=None):
self.trials = zeros(shape=(num_options,), dtype=int)
self.successes = zeros(shape=(num_options,), dtype=int)
self.num_options = num_options