petab_select.problem

The model selection problem class.

Classes

Problem(model_space[, ...])

Handle everything related to the model selection problem.

class petab_select.problem.Problem(model_space, candidate_space_arguments=None, compare=None, criterion=None, method=None, version=None, yaml_path=None)[source]

Handle everything related to the model selection problem.

model_space

The model space.

calibrated_models

Calibrated models. Will be used to augment the model selection problem (e.g. by excluding them from the model space). FIXME(dilpath) refactor out

candidate_space_arguments

Custom options that are used to construct the candidate space.

compare

A method that compares models by selection criterion. See petab_select.model.default_compare() for an example.

criterion

The criterion used to compare models.

method

The method used to search the model space.

version

The version of the PEtab Select format.

yaml_path

The location of the selection problem YAML file. Used for relative paths that exist in e.g. the model space files.

TODO should the relative paths be relative to the YAML or the file that contains them?

__init__(model_space, candidate_space_arguments=None, compare=None, criterion=None, method=None, version=None, yaml_path=None)[source]
exclude_model_hashes(model_hashes)[source]

Exclude models from the model space, by model hashes.

Parameters:

model_hashes (Iterable[str]) – The model hashes.

Return type:

None

exclude_models(models)[source]

Exclude models from the model space.

Parameters:

models (Iterable[Model]) – The models.

Return type:

None

static from_yaml(yaml_path)[source]

Generate a problem from a PEtab Select problem YAML file.

Parameters:

yaml_path (Union[str, Path]) – The location of the PEtab Select problem YAML file.

Return type:

Problem

Returns:

A Problem instance.

get_best(models, criterion=None, compute_criterion=False)[source]

Get the best model from a collection of models.

The best model is selected based on the selection problem’s criterion.

Parameters:
  • models (Optional[Iterable[Model]]) – The best model will be taken from these models.

  • criterion (Optional[str]) – The criterion by which models will be compared. Defaults to self.criterion (e.g. as defined in the PEtab Select problem YAML file).

  • compute_criterion (bool) – Whether to try computing criterion values, if sufficient information is available (e.g., likelihood and number of parameters, to compute AIC).

Return type:

Model

Returns:

The best model.

get_path(relative_path)[source]

Get the path to a resource, from a relative path.

Parameters:

relative_path (Union[str, Path]) – The path to the resource, that is relative to the PEtab Select problem YAML file location.

Return type:

Path

Returns:

The path to the resource.

new_candidate_space(*args, method=None, **kwargs)[source]

Construct a new candidate space.

Parameters:
  • args – Arguments are passed to the candidate space constructor.

  • kwargs – Arguments are passed to the candidate space constructor.

  • method (Method) – The model selection method.

Return type:

CandidateSpace