RegularizedLinearRTO#
- class cuqi.experimental.mcmc.RegularizedLinearRTO(target=None, initial_point=None, maxit=100, inner_max_it=10, stepsize='automatic', penalty_parameter=10, abstol=1e-10, adaptive=True, **kwargs)#
Regularized Linear RTO (Randomize-Then-Optimize) sampler.
Samples posterior related to the inverse problem with Gaussian likelihood and implicit Gaussian prior, and where the forward model is Linear. The sampler works by repeatedly solving regularized linear least squares problems for perturbed data. The solver for these optimization problems is chosen based on how the regularized is provided in the implicit Gaussian prior. Currently we use the following solvers: FISTA: [1] Beck, Amir, and Marc Teboulle. “A fast iterative shrinkage-thresholding algorithm for linear inverse problems.” SIAM journal on imaging sciences 2.1 (2009): 183-202.
Used when prior.proximal is callable.
- ADMM: [2] Boyd et al. “Distributed optimization and statistical learning via the alternating direction method of multipliers.”Foundations and Trends® in Machine learning, 2011.
Used when prior.proximal is a list of penalty terms.
- Parameters:
target (cuqi.distribution.Posterior) – See cuqi.sampler.LinearRTO
initial_point (np.ndarray) – Initial point for the sampler. Optional.
maxit (int) – Maximum number of iterations of the inner FISTA/ADMM solver. Optional.
inner_max_it (int) – Maximum number of iterations of the CGLS solver used within the ADMM solver. Optional.
stepsize (string or float) – If stepsize is a string and equals either “automatic”, then the stepsize is automatically estimated based on the spectral norm. If stepsize is a float, then this stepsize is used.
penalty_parameter (int) – Penalty parameter of the inner ADMM solver. Optional. See [2] or cuqi.solver.ADMM
abstol (float) – Absolute tolerance of the inner FISTA solver. Optional.
adaptive (bool) – If True, FISTA is used as inner solver, otherwise ISTA is used. 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=None, initial_point=None, maxit=100, inner_max_it=10, stepsize='automatic', penalty_parameter=10, abstol=1e-10, adaptive=True, **kwargs)#
Initializer for abstract base class for all samplers.
Any subclassing samplers should simply store input parameters as part of the __init__ method.
The actual initialization of the sampler should be done in the _initialize method.
- Parameters:
target (cuqi.density.Density) – The target density.
initial_point (array-like, optional) – The initial point for the sampler. If not given, the sampler will choose an initial point.
callback (callable, optional) – A function that will be called after each sample is drawn. The function should take two arguments: the sample and the index of the sample. The sample is a 1D numpy array and the index is an integer. The callback function is useful for monitoring the sampler during sampling.
Methods
__init__
([target, initial_point, maxit, ...])Initializer for abstract base class for all samplers.
Return the history of the sampler.
Return the samples.
Return the state of the sampler.
Initialize the sampler by setting and allocating the state and history before sampling starts.
load_checkpoint
(path)Load the state of the sampler from a file.
Re-initialize the sampler.
sample
(Ns[, batch_size, sample_path])Sample Ns samples from the target density.
save_checkpoint
(path)Save the state of the sampler to a file.
set_history
(history)Set the history of the sampler.
set_state
(state)Set the state of the sampler.
step
()Perform one step of the sampler by transitioning the current point to a new point according to the sampler's transition kernel.
tune
(skip_len, update_count)Tune the parameters of the sampler.
Validate the target is compatible with the sampler.
warmup
(Nb[, tune_freq])Warmup the sampler by drawing Nb samples.
Attributes
Dimension of the target density.
Geometry of the target density.
Return the target density.