beanmachine.ppl.inference.proposer.base_single_site_mh_proposer module

class beanmachine.ppl.inference.proposer.base_single_site_mh_proposer.BaseSingleSiteMHProposer(target_rv: beanmachine.ppl.model.rv_identifier.RVIdentifier)

Bases: beanmachine.ppl.inference.proposer.base_proposer.BaseProposer

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

Return a probability distribution of moving self.node to a new value conditioned on its current value in world.

propose(world: beanmachine.ppl.world.world.World)

Propose a new value for self.node with Metropolis-Hasting algorithm Classes that inherit this proposer should override get_proposal_distribution to define the algorithm-specific way to sample the next state.

Parameters

world – World to calculate proposal for.