UGLA#
- class cuqi.sampler.UGLA(target, x0=None, maxit=50, tol=0.0001, beta=1e-05, rng=None, **kwargs)#
Unadjusted (Gaussian) Laplace Approximation sampler
Samples an approximate posterior where the prior is approximated by a Gaussian distribution. The likelihood must be Gaussian.
Currently only works for LMRF priors.
The inner solver is Conjugate Gradient Least Squares (CGLS) solver.
For more details see: Uribe, Felipe, et al. “A hybrid Gibbs sampler for edge-preserving tomographic reconstruction with uncertain view angles.” arXiv preprint arXiv:2104.06919 (2021).
- Parameters:
target (cuqi.distribution.Posterior) – The target posterior distribution to sample.
x0 (ndarray) – Initial parameters. Optional
maxit (int) – Maximum number of inner iterations for solver when generating one sample.
tol (float) – Tolerance for inner solver. Will stop before maxit if the inner solvers convergence check reaches tol.
beta (float) – Smoothing parameter for the Gaussian approximation of the Laplace distribution. Larger beta is easier to sample but is a worse approximation.
rng (np.random.RandomState) – Random number generator used for sampling. Optional
callback (callable, Optional) – If set this function will be called after every sample. The signature of the callback function is callback(sample, sample_index), where sample is the current sample and sample_index is the index of the sample. An example is shown in demos/demo31_callback.py.
- Returns:
Samples from the posterior distribution.
- Return type:
- __init__(target, x0=None, maxit=50, tol=0.0001, beta=1e-05, rng=None, **kwargs)#
Methods
__init__
(target[, x0, maxit, tol, beta, rng])sample
(N[, Nb])sample_adapt
(N[, Nb])step
(x)Perform a single MCMC step
step_tune
(x, *args, **kwargs)Perform a single MCMC step and tune the sampler.
tune
()Tune the sampler parameters.
Attributes