IndependenceProposal¶
- class telescopic.kernels.IndependenceProposal(distribution)¶
The independence proposal \(x' \sim q\), whatever the current state.
The log acceptance ratio is \([\log\pi(x') - \log q(x')] - [\log\pi(x) - \log q(x)]\), with a weight of
-infwhere \(\pi\) is 0, and a proposal where \(q\) is 0 rejected.The states carry a cache of \(\log q(x)\), the fields
independence.<key>.log_q, shape (n,), andindependence.<key>.point, shape (n, d), the point at which it was computed. The key names this proposal object, so that a state stepped by another one, of another distribution, never reads its cache. A value is used only where its point equals the position bit for bit, so that a chain that another kernel moved, or a state without the fields, gets a fresh value. A step and a coupled step evaluate \(\log q\) in one call, at the proposals and at the chains’ states whose value is missing or stale. Wherelog_densitygives a row the same value in any batch, asMultivariateTdoes, the cache changes no number.- Parameters:
- distributionobject
An object with
sample(draws)and a normalizedlog_density(x), such asMultivariateT; one without them raisesTypeError. Itsmean, if it has one that is not a method, fixes the dimension.
- init_extra(state)¶
The cache of \(\log q\) at the chains’ positions.
- 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)\).
- 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