Flowmc
FlowMC-backed sampler for Jim.
Wraps the flowMC Sampler configured with a rational-quadratic
spline normalizing flow and a choice of local MCMC kernel, with optional
parallel tempering.
FlowMCSampler
¤
Bases: Sampler
flowMC sampler backend.
Wraps the flowMC Sampler with a rational-quadratic spline NF
and a configurable local MCMC kernel (MALA, HMC, or GRW) with optional
parallel tempering. The flowMC bundle is built lazily inside
sample so the PRNG key from Jim is used correctly (no duplication
of the seed).
Configured via FlowMCConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_dims
|
int
|
Dimension of the sampling space. |
required |
log_prior_fn
|
Callable
|
Log-prior callable |
required |
log_likelihood_fn
|
Callable
|
Log-likelihood callable |
required |
log_posterior_fn
|
Callable
|
Log-posterior callable |
required |
config
|
Optional[FlowMCConfig]
|
Optional |
None
|
periodic
|
Optional[dict[int, tuple[float, float]]]
|
Optional periodic-parameter spec in index space,
|
None
|
Methods:
| Name | Description |
|---|---|
get_samples |
Return all production samples with their log-likelihoods. |
Attributes:
| Name | Type | Description |
|---|---|---|
strategy_order |
list[str]
|
Ordered list of flowMC strategies. |
strategy_order: list[str]
property
¤
Ordered list of flowMC strategies.
get_samples() -> dict[str, np.ndarray]
¤
Return all production samples with their log-likelihoods.
Production samples are flat arrays in sampling space, shape
(N, n_dims) where N = n_chains * n_production_loops * n_total_steps.
Log-likelihoods are recovered from the stored log-posterior values as
log_likelihood = log_posterior - log_prior, avoiding a second
evaluation of the likelihood function.
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dict with keys |
dict[str, ndarray]
|
|