Advanced API
MCMC Samplers
- surmise.create_sampler(sampler, expert_mode)[source]
Construct a sampler function for direct use by surmise calibrators. The following example demonstrates its use.
sample_with_PTLMC = surmise.create_sampler("PTLMC", expert_mode=False) results = sample_with_PTLMC( logpost_func=log_posterior, draw_func=draw_from_start_distribution, scipy_stats_rng=np.random.default_rng(RAND_SEED), specification=ptlmc_spec )
For typical use cases, samplers are created automatically under-the-hood on behalf of users. Therefore, there is generally no need to explicitly create or access samplers. This function is in the surmise public interface only as an advanced feature for use by developers and power users.
- Parameters:
sampler –
Name of desired sampler offered by surmise. Valid values are
”metropolis_hastings” to use
surmise.utilitiesmethods.sample_with_metropolis_hastings()”LMC” to use research-grade
surmise.utilitiesmethods.sample_with_LMC()”PTLMC” to use
surmise.utilitiesmethods.sample_with_PTLMC()
expert_mode – Allow the use of a research-grade sampler if
True
- Returns:
The desired sampler function.