Standard sampler configuration#
Important
Some of settings discussed here only apply to standard nessai not i-nessai. For i-nessai see Importance nested sampler
There are various settings in nessai which can be configured. These can be grouped in to general settings and proposal settings. The former controls general aspects of the sampler such as the model being sampler or how many live points are used. The latter affect the proposal process and how new points are drawn.
All of the settings are controlled when creating an instance of FlowSampler. The most important settings to consider when using nessai are the reparameterisations used for the proposals.
Key settings#
The most important settings to consider when using nessai with the default FlowProposal are:
reset_flow(defaultFalse): Whether to reset the normalising flow after each time it is trained. If an integer is specified, the flow is reset after every nth time it is trained. This becomes increasingly important for high dimensional problems or problems where the shape of the likelihood changes significantly as the sampling progresses. We recommend trying values between 1 and 16.volume_fraction(default0.95): Fractional value used to truncated the normalising flow latent space when drawing new samples. Lower values are more prone to over-constraining contours whilst higher values can lead to inefficient sampling. If the diagnostics indicate the results are over-constrained, increasing this value may help. We recommend trying values between 0.95 and 0.99.nlive(default2000): Number of live points to use. Increasing this value will lead to more accurate evidence estimates and better exploration of complex, high-dimensional posteriors, but will also increase the runtime. It can also reduce over-constraining since the flow has more sample to learn from.
General configuration#
These are general settings which apply to the whole algorithm and are parsed to NestedSampler. However some of these settings, such as training_frequency which defines how often the proposal method is retrained, will affect the normalising flow used in the proposal class.
Proposal configuration#
The proposal configuration includes a variety of settings ranging from the hyper-parameters for the normalising flow to the size of pool used to store new samples. This also includes the reparameterisations which are essential to efficient sampling. All the available settings are listed below and there are dedicated pages that explain how to configure the reparmeterisations and normalising flows.
- class nessai.proposal.flowproposal.FlowProposal(model, poolsize=None, latent_prior='truncated_gaussian', latent_temperature=None, constant_volume_mode=True, volume_fraction=0.95, fuzz=1.0, fixed_radius=False, drawsize=None, truncate_log_q=False, expansion_fraction=4.0, min_radius=False, max_radius=50.0, compute_radius_with_all=False, enforce_likelihood_threshold=False, **kwargs)#
Object that handles training and proposal points
- Parameters:
- model
nessai.model.Model User defined model.
- latent_prior{‘truncated_gaussian’, ‘gaussian’, ‘uniform_nsphere’, ‘gaussian’}, optional
Prior distribution in the latent space. Defaults to ‘truncated_gaussian’.
- poolsizeint, optional
Size of the proposal pool. Defaults to 10000.
- drawsizeint, optional
Number of points to simultaneously draw when populating the proposal Defaults to 10000
- min_radiusfloat, optional
Minimum radius used for population. If not specified not minimum is used.
- max_radiusfloat, optional
If a float then this value is used as an upper limit for the computed radius when populating the proposal. If unspecified no upper limit is used.
- fixed_radiusfloat, optional
If specified and the chosen latent distribution is compatible, this radius will be used to draw new samples instead of the value computed with the flow.
- constant_volume_modebool
If True, then a constant volume is used for the latent contour used to draw new samples. The exact volume can be set using volume_fraction
- volume_fractionfloat
Fraction of the total probability to contain with the latent contour when using a constant volume.
- compute_radius_with_allbool, optional
If True all the radius of the latent contour is computed using the maximum radius of all the samples used to train the flow.
- fuzzfloat, optional
Fuzz-factor applied to the radius. If unspecified no fuzz-factor is applied.
- expansion_fractionfloat, optional
Similar to
fuzzbut instead a scaling factor applied to the radius this specifies a rescaling for volume of the n-ball used to draw samples. This is translated to a value forfuzz.- truncate_log_qbool, optional
Truncate proposals using minimum log-probability of the training data.
- enforce_likelihood_thresholdbool
If True, enforce the likelihood threshold when performing rejection sampling. If false, the likelihood is not checked when populating the proposal.
- model
Other proposals#
nessai also includes variations on the main FlowProposal class:
nessai.gw.proposal.GWFlowProposalas version ofFlowProposalthat includes specific reparameterisations for gravitational-wave inference.nessai.proposal.augmented.AugmentedFlowProposalthis proposal is designed for highly multimodal likelihoods where the standard proposal can break down. It is based around using Augmented Normalising Flows which introduce extra augment dimensions. See the documentation for further details.