Covariance-adaptive importance sampling

CAIS fits proposal means and covariances from proposal-local samples. It tempers fitting weights when their concentration would make covariance estimation unreliable.

Example

using ImportanceSamplers, PureRNGs, Statisticslogtarget(x) = -(abs2(x[1] - 1) + abs2((x[2] + 1 - 0.8(x[1] - 1)) / 0.6)) / 2bank = ProposalBank([    SphericalGaussian([-1.0, 0.0], 2.0),    SphericalGaussian([ 1.0, 0.0], 2.0),])prepared = prepare_sampler(    Threefry4x32(42), logtarget,    CAIS(bank; rounds=4, round_size=2_000),)samples = importance_sample!(prepared)(mean=mean(samples), covariance=cov(samples))
(mean = [0.9905109275371987, -1.0077497535578692], covariance = [0.9782098026993639 0.7827210118754547; 0.7827210118754547 0.9895005082458677])

The reference mean is [1, -1]. Vector proposals learn a full covariance.

Use equal positive bank masses and a divisible round size. Every proposal needs at least d + 2 samples per round in dimension d.

Estimator and adaptation

Returned weights use the generating proposal, not a full mixture:

\[\ell_{t,j,i}=\log\pi(x_{t,j,i})-\log q_{t,j}(x_{t,j,i}).\]

The next mean always uses the normalized raw local weights. The covariance rule depends on their local ESS:

Local weight ESSCovariance weightsCovariance centre
At least the thresholdRaw normalized weightsOld proposal mean
Below the thresholdPower-tempered weightsTempered weighted mean

The second branch changes the covariance fit, not the returned estimator weights or next mean.

Covariance threshold

algorithm = CAIS(    bank; rounds=4, round_size=2_000,    covariance_ess_threshold=300,)

For local count m, an explicit threshold must satisfy d < threshold < m. The default is max(d + 1, ceil(Int, 0.3m)). That fraction is a package default, not a universal paper prescription.

diagnostics.local_ess records the weights used for the covariance fit. diagnostics.tempering_powers distinguishes raw from tempered fitting.

Covariance replacement and failures

CAIS replaces the covariance rather than blending it. It adds no ridge, eigenvalue floor, or silent old-factor fallback.

Enough samples and sufficient ESS do not guarantee a positive-definite covariance. All-zero local weights, failed tempering, or a failed factorization abort the call. The pre-call population remains committed.

Student-t fits require nu > 2 and convert fitted covariance to Student-t scale. The degrees of freedom stay fixed.

Sources

See Adaptation and reuse and Devices.