Beispiel #1
0
 def __init__(self, data, settings, param, cache, cache_tmp):
     if settings.init_pg == 'smc':
         particles, log_pd, log_weights = init_mcmc_using_smc(data, settings, param, cache, cache_tmp)
     elif settings.init_pg == 'empty':
         n_particles_backup = copy(settings.n_particles)
         settings.n_particles = 1
         particles, log_weights = init_particles(data, settings, param, cache_tmp)
         settings.n_particles = n_particles_backup
         log_pd = -np.inf
         for p in particles:
             p.nodes_processed_itr = [[0]]
             p.grow_nodes_itr = [[0]]
             if settings.verbose >= 2:
                 print 'leaf = %s, non_leaf = %s, node_info = %s' % (p.leaf_nodes, p.non_leaf_nodes, p.node_info)
     if settings.verbose >= 2:
         print '\ninitializing particle mcmc'
         print log_pd
         print log_weights
     self.update_p(particles, log_weights, log_pd, settings)
Beispiel #2
0
 def __init__(self, data, settings, param, cache, cache_tmp):
     if settings.init_pg == 'smc':
         particles, log_pd, log_weights = init_mcmc_using_smc(data, settings, param, cache, cache_tmp)
     elif settings.init_pg == 'empty':
         n_particles_backup = copy(settings.n_particles)
         settings.n_particles = 1
         particles, log_weights = init_particles(data, settings, param, cache_tmp)
         settings.n_particles = n_particles_backup
         log_pd = -np.inf
         for p in particles:
             p.nodes_processed_itr = [[0]]
             p.grow_nodes_itr = [[0]]
             if settings.verbose >= 2:
                 print 'leaf = %s, non_leaf = %s, node_info = %s' % (p.leaf_nodes, p.non_leaf_nodes, p.node_info)
     if settings.verbose >= 2:
         print '\ninitializing particle mcmc'
         print log_pd
         print log_weights
     self.update_p(particles, log_weights, log_pd, settings)