beanmachine.ppl.inference.proposer.nmc.single_site_real_space_nmc_proposer module

class beanmachine.ppl.inference.proposer.nmc.single_site_real_space_nmc_proposer.SingleSiteRealSpaceNMCProposer(node: beanmachine.ppl.model.rv_identifier.RVIdentifier, alpha: float = 10.0, beta: float = 1.0)

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

Single-Site Real Space Newtonian Monte Carlo Proposer See sec. 3.1 of [1]

[1] Arora, Nim, et al. Newtonian Monte Carlo: single-site MCMC meets second-order gradient methods

compute_beta_priors_from_accepted_lr(max_lr_num: int = 5) Tuple[torch.Tensor, torch.Tensor]

Compute Alpha and Beta using Method of Moments.

do_adaptation(world:, accept_log_prob: torch.Tensor, is_accepted: bool = False, *args, **kwargs) None

Do adaption based on the learning rates.

  • world – the world in which we’re operating in.

  • accept_log_prob – Current accepted log prob (Not used in this particular proposer).

  • is_accepted – bool representing whether the new value was accepted.

get_proposal_distribution(world: torch.distributions.distribution.Distribution

Returns the proposal distribution of the node.


world – the world in which we’re proposing a new value for node required to find a proposal distribution which in this case is the fraction of distance between the current value and NMC mean that we’re going to pick as our proposer mean.


The proposal distribution.