Sampling

Sampling a Model

dive.sample(model: dict, **kwargs) InferenceData

Samples the provided model with PyMC.

Depending on the model method, Gibbs sampling is used for none to some of the parameters, and NUTS sampling is used for the rest.

Parameters:
  • model (dict) – The dictionary containing the PyMC model, model parameters, and DEER data from dive.model().

  • **kwargs (dict, optional) – Extra arguments to be passed to pm.sample().

Returns:

trace – An ArviZ InferenceData object containing the posterior samples and some supplementary information.

Return type:

az.InferenceData

See also

pm.sample

Backend Samplers

class dive.samplers.DeltaSampler(*args, **kwargs)

Draws random samples from delta’s posterior.

Draws independent samples of delta from its full conditional (posterior) distribution.

Notes

Initalization needs the following:

L regularization operator/matrix delta_prior the alpha and beta values for delta’s prior

The following model parameter is needed as well and is pulled from the PyMC model context:

P distance distribution

step(point: dict)

Draws a random sample of delta.

class dive.samplers.PSampler(*args, **kwargs)

Draws random non-negative normalized samples from P’s posterior.

Draws independent samples of P (with non-negative elements) from the full conditional (posterior) distribution of P. The returned P is normalized.

Notes

Initalization needs the following:

t time vector Vexp data vector K0 kernel matrix LtL L’*L, where L is the regularization matrix dr the resolution of the distance axis alpha the value of the regularization parameter, if fixed

The following model parameters are needed as well and are pulled from the PyMC model context:

tau precision parameter delta regularization parameter Bend end value of background decay function (at t[-1]) lamb modulation depth V0 overall amplitude

step(point: dict)

Draws a random sample of P.

class dive.samplers.TauSampler(*args, **kwargs)

“Draws random samples from tau’s posterior.

Draws independent samples of tau from its full conditional (posterior) distribution.

Notes

Initalization needs the following:

t time-axis of DEER data Vexp measured DEER signal dr the resolution of the distance axis tau_prior the alpha and beta values for tau’s prior K0 kernel matrix

The following model parameters are needed as well and are pulled from the PyMC model context:

P distance distribution Bend end value of background decay function (at t[-1]) lamb modulation depth V0 overall amplitude

References

step(point: dict)

Draws a random sample of tau.