autofit.Result#
- class autofit.Result(samples_summary: SamplesSummary, paths: Optional[AbstractPaths] = None, samples: Optional[Samples] = None, search_internal: Optional[object] = None, analysis: Optional[Analysis] = None)[source]#
Bases:
AbstractResult
The result of a non-linear search.
The default behaviour is for all key results to be in the samples_summary attribute, which is a concise summary of the results of the non-linear search. The reasons for this to be the main attribute are:
It is concise and therefore has minimal I/O overhead, which is important because when runs are resumed
the results are loaded often, which can become very slow for large results via a samples.csv.
The output.yaml config files can be used to disable the output of the samples.csv file
and search_internal.dill files. This means in order for results to be loaded in a way that allows a run to resume, the samples_summary must contain all results necessary to resume the run.
For this reason, the samples and search_internal attributes are optional. On the first run of a model-fit, they will always contain values as they are passed in via memory from the results of the search. However, if a run is resumed they are no longer available in memory, and they will only be available if their corresponding samples.csv and search_internal.dill files are output on disk and available to load.
This object includes:
The samples_summary attribute, which is a summary of the results of the non-linear search.
The paths attribute, which contains the path structure to the results of the search on the hard-disk and
is used to load the samples and search internal attributes if they are required and not available in memory.
The samples of the non-linear search (E.g. MCMC chains, nested sampling samples) which are used to compute
the maximum likelihood model, posteriors and other properties.
The non-linear search used to perform the model fit in its internal format (e.g. the Dynesty sampler used
by dynesty itself as opposed to PyAutoFit abstract classes).
- Parameters:
samples_summary – A summary of the most important samples of the non-linear search (e.g. maximum log likelihood, median PDF).
paths – The paths to the results of the search, used to load the samples and search internal attributes if they are required and not available in memory.
samples – The samples of the non-linear search, for example the MCMC chains.
search_internal – The non-linear search used to perform the model fit in its internal format.
analysis – The Analysis object that was used to perform the model-fit from which this result is inferred.
Methods
Human-readable dictionary representation of the results
model_absolute
Returns a model where every free parameter is a GaussianPrior with mean the previous result's inferred maximum log likelihood parameter values and sigma the input absolute value a.
model_bounded
Returns a model where every free parameter is a UniformPrior with lower_limit and upper_limit the previous result's inferred maximum log likelihood parameter values minus and plus the bound `b.
model_relative
Returns a model where every free parameter is a GaussianPrior with mean the previous result's inferred maximum log likelihood parameter values and sigma a relative value from the result r.
Attributes
info
instance
log_likelihood
max_log_likelihood_instance
model
Create a new model with the same structure as the previous model, replacing each prior with a new prior created by calculating sufficient statistics from samples and corresponding weights for that prior.
Returns the samples of the non-linear search, for example the MCMC chains or nested sampling samples.
samples_summary
Returns the non-linear search used to perform the model fit in its internal sampler format.
- property samples: Optional[Samples]#
Returns the samples of the non-linear search, for example the MCMC chains or nested sampling samples.
When a model-fit is run the first time, the samples are passed into the result via memory and therefore always available.
However, if a model-fit is resumed the samples are not available in memory and they only way to load them is via the samples.csv file output on the hard-disk. This property handles the loading of the samples from the samples.csv file if they are not available in memory.
- Return type:
The samples of the non-linear search.
- property search_internal#
Returns the non-linear search used to perform the model fit in its internal sampler format.
When a model-fit is run the first time, the search internal is passed into the result via memory and therefore always available.
However, if a model-fit is resumed the search internal is not available in memory and they only way to load it is via the search_internal.dill file output on the hard-disk. This property handles the loading of the search internal from the search_internal.dill file if it is not available in memory.
- Return type:
The non-linear search used to perform the model fit in its internal sampler format.
- property projected_model: AbstractPriorModel#
Create a new model with the same structure as the previous model, replacing each prior with a new prior created by calculating sufficient statistics from samples and corresponding weights for that prior.