Last active
September 21, 2019 12:45
-
-
Save conormm/48fea3718eefff903fe1bed4b138176b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RandomSampler(BaseSampler): | |
def __init__(self, env): | |
super().__init__(env) | |
def choose_k(self): | |
self.k = np.random.choice(self.variants) | |
return self.k | |
def update(self): | |
# nothing to update | |
self.thetaregret[self.i] = np.max(self.theta) - self.theta[self.k] | |
self.a[self.k] += self.reward | |
self.b[self.k] += 1 | |
self.theta = self.a/self.b | |
self.ad_i[self.i] = self.k | |
self.r_i[self.i] = self.reward | |
self.i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment