nessai.flowmodel.importance
FlowModel for use in importance nested sampling.
Module Contents
Classes
Flow Model that contains multiple flows for importance sampler. |
- class nessai.flowmodel.importance.ImportanceFlowModel(config=None, output=None)
Bases:
nessai.flowmodel.base.FlowModel
Flow Model that contains multiple flows for importance sampler.
- property model
The current flow (model).
Returns None if the no models have been added.
- property n_models: int
Number of models (flows)
- initialise() None
Initialise things
- reset_optimiser() None
Reset the optimiser to point at current model.
Uses the original optimiser and kwargs.
- add_new_flow(reset=False)
Add a new flow
- log_prob_ith(x, i)
Compute the log-prob for the ith flow
- log_prob_all(x)
Compute the log probability using all of the stored models.
- sample_ith(i, N=1)
Draw samples from the ith flow
- save_weights(weights_file) None
Save the weights file.
- load_all_weights() None
Load all of the weights files for each flow.
Resets any existing models.
- update_weights_path(weights_path: str, n: int | None = None) None
Update the weights path.
Searches in the specified directory for weights files.
- Parameters:
- weights_pathstr
Path to the directory that contains the weights files.
- nOptional[int]
The number of files to load. If not specified,
n_models
is used instead. Must be specified when resuming since the models list is not saved.
- resume(model_config: dict, weights_path: str | None = None) None
Resume the model