core.samplers.GNPESampler

core.samplers.GNPESampler(model, init_sampler, num_iterations=1)

Base class for GNPE sampler. It wraps a PosteriorModel and a standard Sampler for initialization. The former is used to generate initial samples for Gibbs sampling.

A GNPE network is conditioned on additional “proxy” context theta^, i.e.,

p(theta | theta^, d)

The theta^ depend on theta via a fixed kernel p(theta^ | theta). Combining these known distributions, this class uses Gibbs sampling to draw samples from the joint distribution,

p(theta, theta^ | d)

The advantage of this approach is that we are allowed to perform any transformation of d that depends on theta^. In particular, we can use this freedom to simplify the data, e.g., by aligning data to have merger times = 0 in each detector. The merger times are unknown quantities that must be inferred jointly with all other parameters, and GNPE provides a means to do this iteratively. See https://arxiv.org/abs/2111.13139 for additional details.

Gibbs sampling breaks access to the probability density, so this must be recovered through other means. One way is to train an unconditional flow to represent p(theta^ | d) for fixed d based on the samples produced through the GNPE Gibbs sampling. Starting from these, a single Gibbs iteration gives theta from the GNPE network, along with the probability density in the joint space. This is implemented in GNPESampler provided the init_sampler provides proxies directly and num_iterations = 1.

Attributes (beyond those of Sampler)

init_sampler : Sampler Used for providing initial samples for Gibbs sampling. num_iterations : int Number of Gibbs iterations to perform. iteration_tracker : IterationTracker not set up remove_init_outliers : float not set up

Parameters

Name Type Description Default
model BasePosteriorModel required
init_sampler Sampler Used for generating initial samples required
num_iterations int Number of GNPE iterations to be performed by sampler. 1

Attributes

Name Description
gnpe_parameters
gnpe_proxy_parameters
init_sampler
iteration_tracker
num_iterations The number of GNPE iterations to perform when sampling.
remove_init_outliers