bilby.bilby_mcmc.proposals.NormalizingFlowProposal

class bilby.bilby_mcmc.proposals.NormalizingFlowProposal(priors, weight=1, subset=None, first_fit=1000, fit_multiplier=10, max_training_epochs=1000, scale_fits=1, nsamples_for_density=1000, js_factor=10, fallback=<class 'bilby.bilby_mcmc.proposals.AdaptiveGaussianProposal'>)[source]

Bases: DensityEstimateProposal

A proposal using draws from a Normalizing Flow fit to the chain

Parameters:
priors: bilby.core.prior.PriorDict

The set of priors

weight: float

Weighting factor

subset: list

A list of keys for which to restrict the proposal to (other parameters will be kept fixed)

first_fit: int

The number of steps to take before first fitting the KDE

fit_multiplier: int

The multiplier for the next fit

nsamples_for_density: int

The number of samples to use when fitting the KDE

fallback: bilby.core.sampler.bilby_mcmc.proposal.BaseProposal

A proposal to use before first training

scale_fits: int

A scaling factor for both the initial and subsequent updates

js_factor: float

The factor to use in determining the max-JS factor to terminate training.

max_training_epochs: int

The maximum bumber of traning steps to take

__init__(priors, weight=1, subset=None, first_fit=1000, fit_multiplier=10, max_training_epochs=1000, scale_fits=1, nsamples_for_density=1000, js_factor=10, fallback=<class 'bilby.bilby_mcmc.proposals.AdaptiveGaussianProposal'>)[source]
__call__(chain, likelihood=None, priors=None)[source]

Call self as a function.

Methods

__init__(priors[, weight, subset, ...])

apply_boundaries(point)

apply_periodic_boundary(key, val)

apply_reflective_boundary(key, val)

check_dependencies([warn])

Check the dependencies required to use the proposal

get_training_data(chain)

initialise()

propose(chain)

Propose a new point

refit(chain)

setup_NVP_flow()

setup_basic_flow()

setup_flow()

setup_optimizer()

train(chain)

Attributes

acceptance_ratio

accepted

density_name

n

rejected

static check_dependencies(warn=True)[source]

Check the dependencies required to use the proposal

Parameters:
warn: bool

If true, print a warning

Returns:
check: bool

If true, dependencies exist

propose(chain)[source]

Propose a new point

This method must be overwritten by implemented proposals. The propose method is called by __call__, then boundaries applied, before returning the proposed point.

Parameters:
chain: bilby.core.sampler.bilby_mcmc.chain.Chain

The chain to use for the proposal

Returns:
proposal: bilby.core.sampler.bilby_mcmc.Sample

The proposed point

log_factor: float

The natural-log of the additional factor entering the acceptance probability to ensure detailed balance. For symmetric proposals, a value of 0 should be returned.