Independence

class telescopic.kernels.Independence(proposal=None)

Independence Metropolis-Hastings.

A proposal \(x' \sim q\) is accepted when \(\log u < [\log\pi(x') - \log q(x')] - [\log\pi(x) - \log q(x)]\). The weight \(\pi/q\) is 0 wherever \(\pi\) is 0, even where \(q\) is 0 too, so a chain at zero density accepts any proposal of finite density, as random-walk Metropolis does. A proposal where \(q\) is 0 is rejected, even where \(\pi\) is not: sample drew a point that log_density gives no mass, such as a draw clipped onto the edge of an open support. The coupled step shares the proposal and \(u\) between the chains, which is a maximal kernel coupling (O’Leary, Wang & Jacob 2021): a pair meets when both chains accept. It is a MetropolisHastings with an IndependenceProposal and Shared.

Parameters:
proposalobject, optional

Any object with sample(draws) and log_density(x), the normalized density of what sample draws, positive wherever sample can land. A NaN or +inf log-density raises ValueError with the point. Its mean, if it has one that is not a method, fixes the dimension. None leaves the kernel untuned: tune() fits a Student-\(t_5\) located at the mean of adaptive Metropolis pilot chains, with their covariance as its scale matrix. Its report gives the largest weight \(\pi/q\) of the pilot’s draws relative to their median.

Notes

A step and a coupled step use what the proposal’s sample uses (d + df normals for MultivariateT, d with df=None) and 1 uniform. Each evaluates the proposal’s log_density once, at the proposals and at the chains whose cached value of \(\log q\) is missing or was computed at another point (IndependenceProposal): n rows when the kernel alone moves the chains.

The proposal must be positive wherever the target is. The kernel never moves a chain to where \(q\) is 0, so, used alone, a proposal that misses part of the target’s support never reaches that part, and the estimates are biased from any start, without a warning. A chain at a point where the target is positive and the proposal is 0 rejects every proposal.

Meeting times are geometric only when the weights \(\pi/q\) are bounded; a proposal with lighter tails than the target gives heavy-tailed meeting times. A run then usually gives too little mass to the region where \(\pi/q\) is large, with error bars that are too small and often without a warning.

A tuned proposal covers only the modes that the pilot chains reached. On a target with well-separated modes, the chains can settle in one mode, and pairs then meet quickly in it: the estimates can be confidently wrong, and the pilot’s agreeing chains raise no warning. Give proposal explicitly to cover modes that are known.

Examples

A proposal given explicitly, here a Student-\(t\) whose scale matrix is twice the target’s covariance, leaves nothing to tune, so the run has no tuning report:

>>> from telescopic import examples, kernels, sample
>>> example = examples.gaussian(2)
>>> proposal = kernels.MultivariateT(example.mean, 2 * example.cov)
>>> kernel = kernels.Independence(proposal)
>>> result = sample(
...     example.log_prob, example.initial, kernel=kernel,
...     n_replicates=50, vectorize=True, rng=0,
... )
>>> result.tuning is None
True
property proposal

The proposal distribution \(q\) as it was given, or None while untuned.

It is read-only: tuning builds a new kernel.

Returns:
object or None