MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / Bandit

Class Bandit

rl/comparing_epsilons.py:12–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12class Bandit:
13 def __init__(self, m):
14 self.m = m
15 self.mean = 0
16 self.N = 0
17
18 def pull(self):
19 return np.random.randn() + self.m
20
21 def update(self, x):
22 self.N += 1
23 self.mean = (1 - 1.0/self.N)*self.mean + 1.0/self.N*x
24
25
26def run_experiment(m1, m2, m3, eps, N):

Callers 2

run_experimentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected