LinearRTO#
- class cuqi.sampler.LinearRTO(target, x0=None, maxit=10, tol=1e-06, shift=0, **kwargs)#
Linear RTO (Randomize-Then-Optimize) sampler.
Samples posterior related to the inverse problem with Gaussian likelihood and prior, and where the forward model is linear or more generally affine.
- Parameters:
target (cuqi.distribution.Posterior, cuqi.distribution.MultipleLikelihoodPosterior or 5-dimensional tuple.) –
If target is of type cuqi.distribution.Posterior or cuqi.distribution.MultipleLikelihoodPosterior, it represents the posterior distribution. If target is a 5-dimensional tuple, it assumes the following structure: (data, model, L_sqrtprec, P_mean, P_sqrtrec)
Here: data: is a m-dimensional numpy array containing the measured data. model: is a m by n dimensional matrix, AffineModel or LinearModel representing the forward model. L_sqrtprec: is the squareroot of the precision matrix of the Gaussian likelihood. P_mean: is the prior mean. P_sqrtprec: is the squareroot of the precision matrix of the Gaussian mean.
x0 (np.ndarray) – Initial point for the sampler. Optional.
maxit (int) – Maximum number of iterations of the inner CGLS solver. Optional.
tol (float) – Tolerance of the inner CGLS solver. 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.
- __init__(target, x0=None, maxit=10, tol=1e-06, shift=0, **kwargs)#
Methods
__init__
(target[, x0, maxit, tol, shift])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