def __init__(self, approx=None, estimator=KSD, kernel=test_functions.rbf, **kwargs): warnings.warn('You are using experimental inference Operator. ' 'It requires careful choice of temperature, default is 1. ' 'Default temperature works well for low dimensional problems and ' 'for significant `n_obj_mc`. Temperature > 1 gives more exploration ' 'power to algorithm, < 1 leads to undesirable results. Please take ' 'it in account when looking at inference result. Posterior variance ' 'is often **underestimated** when using temperature = 1.') if approx is None: approx = FullRank( model=kwargs.pop('model', None), local_rv=kwargs.pop('local_rv', None) ) super().__init__(estimator=estimator, approx=approx, kernel=kernel, **kwargs)
def from_mean_field(cls, mean_field, gpu_compat=False): """ Construct FullRankADVI from MeanField approximation Parameters ---------- mean_field : :class:`MeanField` approximation to start with Other Parameters ---------------- gpu_compat : `bool` use GPU compatible version or not Returns ------- :class:`FullRankADVI` """ full_rank = FullRank.from_mean_field(mean_field, gpu_compat) inference = object.__new__(cls) Inference.__init__(inference, KL, full_rank, None) return inference
def from_mean_field(cls, mean_field, gpu_compat=False): """ Construct FullRankADVI from MeanField approximation Parameters ---------- mean_field : MeanField approximation to start with Flags ----- gpu_compat : bool use GPU compatible version or not Returns ------- FullRankADVI """ full_rank = FullRank.from_mean_field(mean_field, gpu_compat) inference = object.__new__(cls) objective = KL(full_rank)(None) inference.objective = objective inference.hist = np.asarray(()) return inference
def __init__(self, *args, **kwargs): super().__init__(FullRank(*args, **kwargs))