sampling_builder#
- deepinv.sampling.sampling_builder(iterator, data_fidelity, prior, params_algo=MappingProxyType({}), max_iter=100, thresh_conv=1e-3, burnin_ratio=0.2, thinning=10, history_size=5, verbose=False, callback=lambda X, **kwargs: ..., **kwargs)[source]#
Helper function for building an instance of the
deepinv.sampling.BaseSamplingclass.See Uncertainty quantification with PnP-ULA. and Markov Chain Monte Carlo for example usage.
See the docs for
deepinv.sampling.BaseSamplingfor further examples and information.- Parameters:
iterator (SamplingIterator | str) – Either a SamplingIterator instance or a string naming the iterator class
data_fidelity (DataFidelity) – Negative log-likelihood function
prior (Prior) – Negative log-prior
params_algo (dict) – Dictionary containing the parameters for the algorithm
max_iter (int) – Number of Monte Carlo iterations
burnin_ratio (float) – Percentage of iterations for burn-in
thinning (int) – Integer to thin the Monte Carlo samples
history_size (int | bool) – Number of most recent samples to store in memory. If
True, all samples are stored. IfFalse, no samples are stored. If an integer, it specifies the number of most recent samples to store. Default: 5verbose (bool) – Whether to print progress
callback (Callable) – A function that is called on every (thinned) sample state dictionary for diagnostics. It is called with the current sample
X, the currentstatistics(a list of Welford objects), and the current iteration numberiteras keyword arguments.kwargs – Additional keyword arguments passed to the iterator constructor when a string is provided as the iterator parameter
- Returns:
Configured BaseSampling instance in eval mode
- Return type: