flat (bool) – If True, the samples are stored as separate keys for each parameter.
If False, the samples are stored in a “samples” key as a dictionary
of parameter arrays.
copy (bool) – If True, the arrays in the dictionary are deep-copied. If False, they
are not copied and may share memory with the original samples.
The dictionary can either be in a flat format, where the samples are
stored as separate keys for each parameter, or in a nested format, where
the samples are stored in a “samples” key as a dictionary of parameter.
Only includes samples, log_likelihood, log_prior, and log_q by default,
since additional fields have varying shapes and may not be compatible
with a DataFrame format.
Parameters:
include (list[str]|None) – List of fields to include in the DataFrame. If None, includes x,
log_likelihood, log_prior, and log_q. x is always included
irrespective of the value of include.
chain – MCMC chain with shape (…, n_dims). For a single chain, this
is typically (n_steps, n_dims). For ensemble samplers, use
(n_steps, n_walkers, n_dims).
log_likelihood – Optional arrays matching the chain shape without the last
dimension. They will be flattened to align with x.
log_prior – Optional arrays matching the chain shape without the last
dimension. They will be flattened to align with x.
log_q – Optional arrays matching the chain shape without the last
dimension. They will be flattened to align with x.
parameters – Optional list of parameter names.
xp – Optional array namespace. If None, inferred from chain.
dtype (Any | str | None) – Optional dtype to use for stored arrays.
device (Any) – Optional device to place arrays on.
thin (int | None) – Optional metadata describing how the chain was processed.
burn_in (int | None) – Optional metadata describing how the chain was processed.
Compute the log evidence using thermodynamic integration.
Notes
By default, follows the implementation outlined in Section 2.1.3 of
Annis et al. (2019) [1]_. If method=”variance”, the error is estimated
using the variance of the TI estimate across samples as in Eq. (37).
If method=”coarse”, the error is estimated by comparing to a coarser
integration using every other temperature, as in the original ptemcee
implementation.
Parameters:
burn_in_fraction (float | None) – Fraction of initial samples to discard as burn-in. If None, no burn-in is discarded.
This is applied independently to each temperature chain before integration.
method (str) – Method for estimating the uncertainty in the log evidence.
Options are “variance” or “coarse”. See Notes for details.
Returns:
log_evidence – The estimated log evidence from thermodynamic integration.
log_evidence_error – An estimate of the uncertainty in the log evidence.
Compute the log evidence using the stepping-stone estimator.
Notes
Follows the implementation outlined in Section 2.2.3 of Annis et al. (2019) [1]_
Parameters:
burn_in_fraction (float | None) – Fraction of initial samples to discard as burn-in. If None, no burn-in is discarded.
This is applied independently to each temperature chain before integration.
Returns:
log_evidence – The estimated log evidence from thermodynamic integration.
log_evidence_error – An estimate of the uncertainty in the log evidence.