Proposal¶
- class telescopic.kernels.Proposal¶
A Metropolis-Hastings proposal for a batch of chains: its draw, its evaluation and its log acceptance ratio.
A subclass implements
sample()andlog_alpha(), andevaluate()when its proposals’ states need other fields than the current states’. A coupled step callslog_alpha()once for each chain. A proposal with fields of its own in aState’sextragives their initial values ininit_extra(), andevaluate()can fill them at the proposals.- evaluate(target, x, like)¶
The states at the proposals
x, with the fields oflike.
- init_extra(state)¶
The initial values of the proposal’s own fields; none by default.
- abstractmethod log_alpha(target, current, proposed, forward)¶
The log acceptance ratios \(\log\pi(x') - \log\pi(x) + \log q(x \mid x') - \log q(x' \mid x)\).
- property needs_grad¶
Whether the proposal needs the gradient of the log-density at the current states.
- Returns:
- abstractmethod sample(target, state, draws)¶
Draw a proposal \(x' \sim q(\cdot \mid x)\) for each chain.
- Parameters:
- Returns:
- x
ndarray, shape (n, d) The proposals.
- forward
What
log_alpha()needs of the draw, orNone.
- x