MetropolisHastings¶
- class telescopic.kernels.MetropolisHastings(proposal, coupling)¶
A Metropolis-Hastings kernel from a proposal, coupled by a coupling of that proposal.
A step draws \(x' \sim q(\cdot \mid x)\) and accepts it when \(\log u < \log\pi(x') - \log\pi(x) + \log q(x \mid x') - \log q(x' \mid x)\). A coupled step draws both chains’ proposals from
coupling, evaluates identical proposals once, and accepts each with the same uniform. When the coupling returns one array for both chains, asShareddoes, the step evaluates it once and gives both chains its state.- Parameters:
- proposalProposal or
None The proposal of every chain.
Noneleaves the kernel untuned, for a subclass that sets its proposal by tuning, asRandomWalkdoes.- couplingCoupling
A coupling whose
supports(proposal)is true; otherwiseValueError.
- proposalProposal or
- coupled_step(target, state_x, state_y, draws)¶
One coupled transition of each pair.
- init_extra(state)¶
The initial values of the kernel’s own fields at the chains of
state.init_state()attaches them; none by default.
- step(target, state, draws)¶
One transition of each chain.
- Parameters:
- Returns: