autofit.GridSearchResult#

class autofit.GridSearchResult(samples: List[SamplesInterface], lower_limits_lists: Union[List, GridList], grid_priors: List[Prior], parent: Optional[NonLinearSearch] = None)[source]#

Bases: object

The sample of a grid search.

Parameters:
  • samples – The samples of the non linear optimizations performed at each grid step

  • lower_limits_lists – A list of lists of values representing the lower bounds of the grid searched values at each step

Methods

attribute_grid

Get a list of the attribute of the best instance from every search in a numpy array with the native dimensions of the grid search.

figure_of_merits

Convenience method to get either the log likelihoods or log evidences of the grid search.

log_evidences

The maximum log evidence of every grid search on a NumPy array whose shape is the native dimensions of the grid search.

log_likelihoods

The maximum log likelihood of every grid search on a NumPy array whose shape is the native dimensions of the grid search.

Attributes

all_models

returns: all_models -- All model mapper instances used in the grid search :rtype: [mm.ModelMapper]

best_model

returns: best_model -- The model mapper instance associated with the highest figure of merit from the grid search :rtype: mm.ModelMapper

best_samples

The best sample of the grid search.

centres_lists

The centre values for each grid square

physical_centres_lists

The middle physical values for each grid square

physical_lower_limits_lists

The lower physical values for each grid square

physical_step_sizes

physical_upper_limits_lists

The upper physical values for each grid square

shape

upper_limits_lists

The upper values for each grid square

property physical_lower_limits_lists: GridList#

The lower physical values for each grid square

property physical_centres_lists: GridList#

The middle physical values for each grid square

property physical_upper_limits_lists: GridList#

The upper physical values for each grid square

property upper_limits_lists: GridList#

The upper values for each grid square

property centres_lists: List#

The centre values for each grid square

property best_samples#

The best sample of the grid search. That is, the sample output by the non linear search that had the highest maximum figure of merit.

Returns:

best_sample

Return type:

sample

property best_model#

returns: best_model – The model mapper instance associated with the highest figure of merit from the grid search :rtype: mm.ModelMapper

property all_models#

returns: all_models – All model mapper instances used in the grid search :rtype: [mm.ModelMapper]

attribute_grid(attribute_path: Union[str, Iterable[str]]) GridList[source]#

Get a list of the attribute of the best instance from every search in a numpy array with the native dimensions of the grid search.

Parameters:

attribute_path – The path to the attribute to get from the instance

Return type:

A numpy array of the attribute of the best instance from every search in the grid search.

log_likelihoods(relative_to_value: float = 0.0) GridList[source]#

The maximum log likelihood of every grid search on a NumPy array whose shape is the native dimensions of the grid search.

For example, for a 2x2 grid search the shape of the Numpy array is (2,2) and it is numerically ordered such that the first search’s maximum likelihood (corresponding to unit priors (0.0, 0.0)) are in the first value (E.g. entry [0, 0]) of the NumPy array.

Parameters:

relative_to_value – The value to subtract from every log likelihood, for example if Bayesian model comparison is performed on the grid search and the subtracted value is the maximum log likelihood of a previous search.

log_evidences(relative_to_value: float = 0.0) GridList[source]#

The maximum log evidence of every grid search on a NumPy array whose shape is the native dimensions of the grid search.

For example, for a 2x2 grid search the shape of the Numpy array is (2,2) and it is numerically ordered such that the first search’s maximum evidence (corresponding to unit priors (0.0, 0.0)) are in the first value (E.g. entry [0, 0]) of the NumPy array.

Parameters:

relative_to_value – The value to subtract from every log likelihood, for example if Bayesian model comparison is performed on the grid search and the subtracted value is the maximum log likelihood of a previous search.

figure_of_merits(use_log_evidences: bool, relative_to_value: float = 0.0) GridList[source]#

Convenience method to get either the log likelihoods or log evidences of the grid search.

Parameters:
  • use_log_evidences – If true, the log evidences are returned, otherwise the log likelihoods are returned.

  • relative_to_value – The value to subtract from every log likelihood, for example if Bayesian model comparison is performed on the grid search and the subtracted value is the maximum log likelihood of a previous search.