def log_prior(self, leaf_values): return T.mean( log_normal(leaf_values, T.zeros_like(leaf_values, dtype='float32'), T.ones_like(leaf_values, dtype='float32'), self.embedding_size, dim=2))
def log_likelihood(self, states, costs): mean = self.evaluate(states) stdev = T.ones_like(mean) * self.stdev return stats.GaussianScaleDiag([ stdev, mean ]).log_likelihood(costs)
def _sample(self, num_samples): a = self.get_parameters('natural')[Stats.X] d = self.shape()[-1] gumbel_noise = Gumbel(T.zeros_like(a), T.ones_like(a)).sample(num_samples) return T.one_hot(T.argmax(a[None] + gumbel_noise, -1), d)