nessai.proposal.flowproposal.truncation#
Truncation rules for flow proposals.
Classes#
Base class for truncation rules. |
|
Filter latent samples using a radial threshold. |
|
Truncate samples using the minimum live-point log q. |
|
Truncate samples using the current likelihood threshold. |
|
Apply an ordered set of truncation rules. |
Functions#
|
Return deprecated latent-radius arguments that were explicitly set. |
Build sparse latent-radius kwargs from deprecated proposal arguments. |
|
|
Normalise truncation-method input into an ordered unique list. |
|
Check if latent-radius truncation should be enabled from kwargs. |
|
Build the effective truncation-method list from legacy and new inputs. |
|
Apply canonical default truncation configuration. |
|
Normalise truncation kwargs into the canonical method-keyed form. |
Get the truncation rule class for a configured method name. |
Module Contents#
- nessai.proposal.flowproposal.truncation.get_deprecated_latent_radius_arguments(**kwargs) list[str]#
Return deprecated latent-radius arguments that were explicitly set.
- nessai.proposal.flowproposal.truncation.get_deprecated_latent_radius_kwargs(**kwargs) dict#
Build sparse latent-radius kwargs from deprecated proposal arguments.
- nessai.proposal.flowproposal.truncation.normalise_truncation_methods(truncation_method=None, truncation_methods=None) list[str]#
Normalise truncation-method input into an ordered unique list.
- nessai.proposal.flowproposal.truncation.should_enable_latent_radius(latent_radius_kwargs=None) bool#
Check if latent-radius truncation should be enabled from kwargs.
- nessai.proposal.flowproposal.truncation.build_truncation_methods(truncation_method=None, truncation_methods=None, truncate_log_q=False, enforce_likelihood_threshold=False, latent_radius_kwargs=None, default_latent_radius: bool = False) list[str]#
Build the effective truncation-method list from legacy and new inputs.
- nessai.proposal.flowproposal.truncation.apply_default_truncation_config(methods, truncation_kwargs=None, *, default_latent_radius: bool = False)#
Apply canonical default truncation configuration.
- nessai.proposal.flowproposal.truncation.normalise_truncation_kwargs(truncation_method=None, truncation_methods=None, truncation_kwargs=None)#
Normalise truncation kwargs into the canonical method-keyed form.
- class nessai.proposal.flowproposal.truncation.BaseTruncationRule#
Base class for truncation rules.
- property requires_log_likelihood: bool#
Indicate if the rule needs log-likelihood values.
- configure(proposal) None#
Apply any proposal-level configuration needed by the rule.
- prepare(proposal, worst_point, radius=None)#
Prepare per-population data for the rule.
- apply_latent(proposal, z)#
Apply truncation in latent space before the inverse pass.
- apply_after_backward(proposal, x, log_q, z)#
Apply truncation after the inverse pass and rescaling.
- apply_after_likelihood(proposal, x, log_q, z)#
Apply truncation after likelihood evaluation.
- reset() None#
Reset transient state.
- class nessai.proposal.flowproposal.truncation.LatentRadiusTruncation(radius_mode: str | None = None, fixed_radius: float | bool = False, min_radius: float | bool = False, max_radius: float | bool = 50.0, compute_radius_with_all: bool = False, constant_volume_mode: bool = False, volume_fraction: float = 0.95, fuzz: float = 1.0, expansion_fraction: float | None = 4.0)#
Bases:
BaseTruncationRuleFilter latent samples using a radial threshold.
- to_kwargs() dict#
Return keyword arguments that reconstruct the rule.
- configure(proposal) None#
Apply any proposal-level configuration needed by the rule.
- prepare(proposal, worst_point, radius=None)#
Prepare per-population data for the rule.
- apply_latent(proposal, z)#
Apply truncation in latent space before the inverse pass.
- class nessai.proposal.flowproposal.truncation.MinLogQTruncation#
Bases:
BaseTruncationRuleTruncate samples using the minimum live-point log q.
- prepare(proposal, worst_point, radius=None)#
Prepare per-population data for the rule.
- apply_after_backward(proposal, x, log_q, z)#
Apply truncation after the inverse pass and rescaling.
- class nessai.proposal.flowproposal.truncation.LikelihoodThresholdTruncation#
Bases:
BaseTruncationRuleTruncate samples using the current likelihood threshold.
- property requires_log_likelihood: bool#
Indicate if the rule needs log-likelihood values.
- prepare(proposal, worst_point, radius=None)#
Prepare per-population data for the rule.
- apply_after_likelihood(proposal, x, log_q, z)#
Apply truncation after likelihood evaluation.
- nessai.proposal.flowproposal.truncation.get_truncation_rule_class(name: str)#
Get the truncation rule class for a configured method name.
- class nessai.proposal.flowproposal.truncation.TruncationScheme(rules: list[BaseTruncationRule] | None = None)#
Apply an ordered set of truncation rules.