Beispiel #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
Beispiel #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))
Beispiel #3
0
 def mean_variable(self):
     return flatten(ts_to_array(super().ts_variables))
Beispiel #4
0
 def grad(self, x, **kwargs):
     return flatten(ts_to_array(self.ts_grad(array_to_ts(x), **kwargs)))
Beispiel #5
0
 def fun(self, x, **kwargs):
     return ts_to_array(self.ts_fun(array_to_ts(x)), **kwargs)
 def grad(self, xs, **kwargs):
     """ Derivative with respect to xs. """
     return ts_to_array(self.ts_grad(array_to_ts(xs), **kwargs))