gemlib.mcmc.mcmc#
- gemlib.mcmc.mcmc(num_samples, sampling_algorithm, target_density_fn, initial_position, seed, kernel_kwargs_fn=<function <lambda>>)#
Runs an MCMC using sampling_algorithm
- Parameters:
num_updates – integer giving the number of updates
sampling_algorithm (SamplingAlgorithm) – an instance of SamplingAlgorithm
target_density_fn (Callable[[Any, ...], float]) – Python callable which takes an argument like current_state and returns its (possibly unnormalized) log-density under the target distribution.
initial_position (Iterable) – initial state structured tuple
seed (tuple[int, int]) – an optional list of two scalar
inttensors.kernel_kwargs_fn – a callable taking the chain position as an argument, and returning a dictionary of extra kwargs
- Returns:
A tuple containing samples of the Markov chain and information about the behaviour of the sampler(s) (e.g. whether kernels accepted or rejected, adaptive covariance matrices, etc).