def init_mcmc_using_smc(data, settings, param, cache, cache_tmp): # initialization via PMCMC done using different ESS and 100 particles ess_threshold_backup = settings.ess_threshold #settings.ess_threshold = 0.1 # FIXME: use the same ESS threshold as before n_particles_backup = settings.n_particles settings.n_particles = 100 particles, log_pd, log_weights = init_run_smc(data, settings, param, cache, cache_tmp) settings.ess_threshold = ess_threshold_backup settings.n_particles = n_particles_backup return (particles, log_pd, log_weights)
def sample(self, data, settings, param, cache, cache_tmp): # Particle Gibbs (PG) sampler particles, log_pd, log_weights = init_run_smc(data, settings, param, cache, cache_tmp, self.p) change = self.update_p(particles, log_weights, log_pd, settings) return change