pypesto.select.postprocessors

Process a model selection ModelProblem after calibration.

Functions

model_id_binary_postprocessor(problem)

Change a PEtab Select model ID to a binary string.

multi_postprocessor(problem[, postprocessors])

Combine multiple postprocessors into a single postprocessor.

report_postprocessor(problem, output_filepath)

Create a TSV table of model selection results.

save_postprocessor(problem[, output_path, ...])

Save the parameter estimation result.

waterfall_plot_postprocessor(problem[, ...])

Produce a waterfall plot.

pypesto.select.postprocessors.model_id_binary_postprocessor(problem)[source]

Change a PEtab Select model ID to a binary string.

Changes the model ID in-place to be a string like M_ijk, where i, j, k, etc. are 1 if the parameter in that position is estimated, or 0 if the parameter is fixed.

To ensure that other postprocessors (e.g. report_postprocessor()) use this new model ID, when in use with a multi_postprocessor(), ensure this is before the other postprocessors in the postprocessors argument of multi_postprocessor().

Parameters:

problem (ModelProblem) – A model selection ModelProblem that has been optimized.

pypesto.select.postprocessors.multi_postprocessor(problem, postprocessors=None)[source]

Combine multiple postprocessors into a single postprocessor.

See save_postprocessor() for usage hints.

Parameters:
  • problem (ModelProblem) – A model selection ModelProblem that has been optimized.

  • postprocessors (list[Callable[[ModelProblem], None]]) – A list of postprocessors, which will be sequentially applied to the optimized model problem. The location where results will be stored.

pypesto.select.postprocessors.report_postprocessor(problem, output_filepath, criteria=None)[source]

Create a TSV table of model selection results.

Parameters:
  • problem (ModelProblem) – A model selection ModelProblem that has been optimized.

  • output_filepath (Union[str, Path]) – The file path where the report will be saved.

  • criteria (list[Criterion]) – The criteria that will be in the report. Defaults to nllh, AIC, AICc, and BIC.

pypesto.select.postprocessors.save_postprocessor(problem, output_path='.', use_model_hash=False)[source]

Save the parameter estimation result.

When used, first set the output folder for results, e.g. with functools.partial(). This is because postprocessors should take only a single parameter: an optimized model.

from functools import partial
output_path = 'results'
pp = partial(save_postprocessor, output_path=output_path)
selector = pypesto.select.ModelSelector(
    problem=problem,
    model_postprocessor=pp,
)
Parameters:
  • problem (ModelProblem) – A model selection ModelProblem that has been optimized.

  • output_path (Union[str, Path]) – The location where output will be stored.

  • use_model_hash (bool) – Whether the filename should use the model hash. Defaults to False, in which case the model ID is used instead.

pypesto.select.postprocessors.waterfall_plot_postprocessor(problem, output_path='.')[source]

Produce a waterfall plot.

See save_postprocessor() for usage hints and argument documentation.

Parameters:
  • problem (ModelProblem)

  • output_path (str | Path)