ProposalBasedSampler#

class cuqi.experimental.mcmc.ProposalBasedSampler(target=None, proposal=None, scale=1, **kwargs)#

Abstract base class for samplers that use a proposal distribution.

__init__(target=None, proposal=None, scale=1, **kwargs)#

Initializer for abstract base class for samplers that use a proposal distribution.

Any subclassing samplers should simply store input parameters as part of the __init__ method.

Initialization of the sampler should be done in the _initialize method.

See Sampler for additional details.

Parameters:
  • target (cuqi.density.Density) – The target density.

  • proposal (cuqi.distribution.Distribution, optional) – The proposal distribution. If not specified, the default proposal is used.

  • scale (float, optional) – The scale parameter for the proposal distribution.

  • **kwargs (dict) – Additional keyword arguments passed to the Sampler initializer.

Methods

__init__([target, proposal, scale])

Initializer for abstract base class for samplers that use a proposal distribution.

get_history()

Return the history of the sampler.

get_samples()

Return the samples.

get_state()

Return the state of the sampler.

initialize()

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.

reinitialize()

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_proposal()

Validate the proposal distribution.

validate_target()

Validate the target is compatible with the sampler.

warmup(Nb[, tune_freq])

Warmup the sampler by drawing Nb samples.

Attributes

dim

Dimension of the target density.

geometry

Geometry of the target density.

proposal

The proposal distribution.

target

Return the target density.