petab_select.ui

Functions

end_iteration(problem, candidate_space, ...)

Finalize model selection iteration.

get_best(problem, models[, criterion])

Get the best model from a list of models.

model_to_petab(model[, output_path])

Generate the PEtab problem for a model.

models_to_petab(models[, output_path_prefix])

Generate the PEtab problems for a list of models.

start_iteration(problem[, candidate_space, ...])

Search the model space for candidate models.

start_iteration_result(candidate_space)

Get the state after starting the iteration.

write_summary_tsv(problem[, ...])

petab_select.ui.end_iteration(problem, candidate_space, calibrated_models)[source]

Finalize model selection iteration.

All models from the current iteration are provided to the calibration tool. This includes user-calibrated models that the tool did not see until now.

A termination signal is also provided, if the model selection algorithm ends.

Parameters:
  • problem (Problem) – The PEtab Select problem.

  • candidate_space (CandidateSpace) – The candidate space.

  • calibrated_models (Models) – The calibration results for the uncalibrated models of this iteration.

Returns:

petab_select.constants.MODELS:

All calibrated models for the current iteration.

petab_select.constants.TERMINATE:

Whether PEtab Select has decided to end the model selection, as a boolean.

Return type:

A dictionary, with the following items

petab_select.ui.get_best(problem, models, criterion=None)[source]

Get the best model from a list of models.

Parameters:
  • problem (Problem) – The PEtab Select problem.

  • models (list[Model]) – The list of models.

  • criterion (str | Criterion | None) – The criterion by which models will be compared. Defaults to problem.criterion.

Return type:

Model

Returns:

The best model.

petab_select.ui.model_to_petab(model, output_path=None)[source]

Generate the PEtab problem for a model.

Parameters:
  • model (Model) – The model.

  • output_path (str | Path | None) – If specified, the PEtab problem will be output to files in this directory.

Return type:

dict[str, Problem | str | Path]

Returns:

The PEtab problem, and the path to the PEtab problem YAML file, if an output path is provided.

petab_select.ui.models_to_petab(models, output_path_prefix=None)[source]

Generate the PEtab problems for a list of models.

Parameters:
  • models (Models) – The list of model.

  • output_path_prefix (list[str | Path] | None) – If specified, the PEtab problem will be output to files in subdirectories of this path, where each subdirectory corresponds to a model.

Return type:

list[dict[str, Problem | str | Path]]

Returns:

The PEtab problems, and the paths to the PEtab problem YAML files, if an output path prefix is provided.

petab_select.ui.start_iteration(problem, candidate_space=None, limit=inf, limit_sent=inf, excluded_hashes=None, criterion=None, user_calibrated_models=None)[source]

Search the model space for candidate models.

The predecessor model can be specified in the candidate_space (CandidateSpace.set_predecessor_model). If `candidate_space() is not provided, then the predecessor model can be specified in problem (Problem.candidate_space_arguments).

Parameters:
  • problem (Problem) – A PEtab Select problem.

  • candidate_space (CandidateSpace | None) – The candidate space. Defaults to a new candidate space based on the method defined in the problem.

  • limit (float | int) – The maximum number of models to add to the candidate space.

  • limit_sent (float | int) – The maximum number of models sent to the candidate space (which are possibly rejected and excluded).

  • excluded_hashes (list[ModelHash] | None) – Hashes of models that will be excluded from the candidate space.

  • criterion (Criterion | None) – The criterion by which models will be compared. Defaults to the criterion defined in the PEtab Select problem.

  • user_calibrated_models (Models | None) – Models that were already calibrated by the user. If a model in the candidates has the same hash as a model in user_calibrated_models, then the candidate will be replaced with the calibrated version. Calibration tools will only receive uncalibrated models from this method.

Returns:

petab_select.constants.CANDIDATE_SPACE:

The candidate space.

petab_select.constants.MODELS:

The uncalibrated models of the current iteration.

Return type:

A dictionary, with the following items