beanmachine.ppl.inference.proposer.single_site_random_walk_proposer module

class beanmachine.ppl.inference.proposer.single_site_random_walk_proposer.SingleSiteRandomWalkProposer(node, step_size: float)

Bases: beanmachine.ppl.inference.proposer.single_site_ancestral_proposer.SingleSiteAncestralProposer

beta_dist_from_moments(mu, sigma)

Returns a Beta distribution.

Parameters
  • mu – mu value

  • sigma – sigma value

Returns

returns the Beta distribution given mu and sigma.

dirichlet_dist_from_moments(mu, sigma)

Returns a Dirichlet distribution. The variances of a Dirichlet distribution are inversely proportional to the norm of the concentration vector. However, variance is only set as a scalar, not as a vector. So the individual variances of the Dirichlet are not tuned, only the magnitude of the entire vector.

Parameters
  • mu – mu value

  • sigma – sigma value

Returns

returns the Dirichlet distribution given mu and sigma.

do_adaptation(world, accept_log_prob, *args, **kwargs) None
gamma_dist_from_moments(expectation, sigma)

Returns a Gamma distribution.

Parameters
  • expectation – expectation value

  • sigma – sigma value

Returns

returns the Beta distribution given mu and sigma.

get_proposal_distribution(world: beanmachine.ppl.world.world.World) torch.distributions.distribution.Distribution

Propose a new value for self.node using the prior distribution.