def max(self, x): s = x.dot(self.w) # log_p = log_softmax(s) # u = np.random.uniform(0.0, 1.0, s.shape) # r = np.log(-np.log(u)) - log_p # return argmax(-r) return argmax(s)
def _draw_thompson(self, x): # self._update_cholesky() # v = 0.5 * np.sqrt(9 * self.d * np.log(max(1, self.t) / self.delta)) # u = np.random.standard_normal(self.w.shape) means = np.dot(x, self.w) stds = self.alpha * self._bound(x) s = np.empty(self.k) for i in range(self.k): s[i] = np.random.normal(means[i], stds[i]) return argmax(s)
def max(self, x): s = x.dot(self.w) return argmax(s)
def draw(self, x): s = x.dot(self.w) log_p = log_softmax(s / self.tau) u = np.random.uniform(0.0, 1.0, s.shape) r = np.log(-np.log(u)) - log_p return argmax(-r)
def max(self, x): return argmax(x.dot(self.w))
def _draw_ucb(self, x): s = np.dot(x, self.w) + self.alpha * self._bound(x) s = np.minimum(1.0, s) return argmax(s)