Ejemplo n.º 1
0
 def predict_w_noise(self, xs, stochastic=True, **kwargs):
     ts_ys, ts_ms, _ = self.ts_predict_all(array_to_ts(xs),
                                           stochastic=stochastic,
                                           **kwargs)
     ys, ms = ts_to_array(ts_ys), ts_to_array(ts_ms)
     ns = ys - ms
     return ys, ms
Ejemplo n.º 2
0
 def kl(self, other, xs, reversesd=False, **kwargs):
     """ Return the KL divergence for each data point in the batch xs. """
     return ts_to_array(self.ts_kl(other, array_to_ts(xs), reversesd=reversesd))
Ejemplo n.º 3
0
 def mean_variable(self):
     return flatten(ts_to_array(super().ts_variables))
Ejemplo n.º 4
0
 def grad(self, x, **kwargs):
     return flatten(ts_to_array(self.ts_grad(array_to_ts(x), **kwargs)))
Ejemplo n.º 5
0
 def fun(self, x, **kwargs):
     return ts_to_array(self.ts_fun(array_to_ts(x)), **kwargs)
Ejemplo n.º 6
0
 def grad(self, xs, **kwargs):
     """ Derivative with respect to xs. """
     return ts_to_array(self.ts_grad(array_to_ts(xs), **kwargs))