Skip to content

Instantly share code, notes, and snippets.

Avatar

rmminusrslash

View GitHub Profile
@rmminusrslash
rmminusrslash / gist:16e20739ba8c2d06bdba1f696e409dfd
Last active Jan 3, 2019
DIscover conda kernels in jupyter
View gist:16e20739ba8c2d06bdba1f696e409dfd
environment must have
ipykernel
View bandit_simulations.py
import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):
CTRs_that_generated_data = np.tile(np.random.rand(K),(num_samples,1))
true_rewards = np.random.rand(num_samples,K) < CTRs_that_generated_data
return true_rewards,CTRs_that_generated_data