LangevinProposal¶
- class telescopic.kernels.LangevinProposal(factor, inverse)¶
The Langevin proposal \(x' = x + B(h/2 + z)\), with \(h = B^\top\nabla\log\pi(x)\).
With \(z \sim \mathcal N(0, I)\), it is a draw from \(q(\cdot \mid x) = \mathcal N(x + BB^\top\nabla\log\pi(x)/2, BB^\top)\), and the log ratio of the proposal densities is \((\lVert z\rVert^2 - \lVert z + (h + h')/2\rVert^2)/2\). A proposal with a non-finite position is not evaluated: its log-density is
-inf, a rejection.- Parameters:
- factorarray_like, shape (d, d)
\(B\), a factor of the proposal covariance \(BB^\top\), such as its Cholesky factor.
- inversearray_like, shape (d, d)
\(B^{-1}\), checked against
factorto within rounding; a matrix that is not its inverse raisesValueError.
- evaluate(target, x, like)¶
The states at the proposals
x, with the fields oflike.
- 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:
- 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