|
14 | 14 | "\n", |
15 | 15 | "<img src=\"https://github.com/ICB-DCM/pyPESTO/raw/main/doc/logo/logo_wordmark.png\" width=\"40%\" alt=\"pyPESTO logo\"/>\n", |
16 | 16 | "\n", |
17 | | - "pyPESTO is a python package for parameter inference, offering a unified interface to various optimization and sampling methods. \n", |
| 17 | + "pyPESTO is a python package for parameter inference, offering a unified interface to various optimization and sampling methods.\n", |
18 | 18 | "pyPESTO is highly modular and customizable, e.g., with respect to objective function definition and employed inference algorithms." |
19 | 19 | ] |
20 | 20 | }, |
|
92 | 92 | "name": "#%% md\n" |
93 | 93 | } |
94 | 94 | }, |
95 | | - "source": [ |
96 | | - "Define lower and upper parameter bounds and create an optimization problem. " |
97 | | - ] |
| 95 | + "source": "Define lower and upper parameter bounds and create an optimization problem." |
98 | 96 | }, |
99 | 97 | { |
100 | 98 | "cell_type": "code", |
|
197 | 195 | "\n", |
198 | 196 | "<img src=\"https://github.com/PEtab-dev/PEtab/blob/main/doc/v1/gfx/petab_files.png?raw=true\" width=\"80%\" alt=\"PEtab files\"/>\n", |
199 | 197 | "\n", |
200 | | - "PyPESTO supports the [PEtab](https://github.com/PEtab-dev/PEtab) standard. PEtab is a data format for specifying parameter estimation problems in systems biology. \n", |
| 198 | + "PyPESTO supports the [PEtab](https://github.com/PEtab-dev/PEtab) standard. PEtab is a data format for specifying parameter estimation problems in systems biology.\n", |
201 | 199 | "\n", |
202 | | - "A PEtab problem consist of an [SBML](https://sbml.org) file, defining the model topology and a set of `.tsv` files, defining experimental conditions, observables, measurements and parameters (and their optimization bounds, scale, priors...). All files that make up a PEtab problem can be structured in a `.yaml` file. The `pypesto.Objective` coming from a PEtab problem corresponds to the negative-log-likelihood/negative-log-posterior distribution of the parameters. \n", |
| 200 | + "A PEtab problem consist of an [SBML](https://sbml.org) file, defining the model topology and a set of `.tsv` files, defining experimental conditions, observables, measurements and parameters (and their optimization bounds, scale, priors...). All files that make up a PEtab problem can be structured in a `.yaml` file. The `pypesto.Objective` coming from a PEtab problem corresponds to the negative-log-likelihood/negative-log-posterior distribution of the parameters.\n", |
203 | 201 | "\n", |
204 | 202 | "For more details on PEtab, the interested reader is referred to [PEtab's format definition](https://petab.readthedocs.io/en/latest/documentation_data_format.html), for examples, the reader is referred to the [PEtab benchmark collection](https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab). The Model from _[Böhm et al. JProteomRes 2014](https://pubs.acs.org/doi/abs/10.1021/pr5006923)_ is part of the benchmark collection and will be used as the running example throughout this notebook.\n", |
205 | 203 | "\n", |
|
237 | 235 | "problem = importer.create_problem(verbose=False)" |
238 | 236 | ] |
239 | 237 | }, |
| 238 | + { |
| 239 | + "cell_type": "code", |
| 240 | + "execution_count": null, |
| 241 | + "metadata": {}, |
| 242 | + "outputs": [], |
| 243 | + "source": [ |
| 244 | + "petab_yaml" |
| 245 | + ] |
| 246 | + }, |
240 | 247 | { |
241 | 248 | "cell_type": "markdown", |
242 | 249 | "metadata": { |
|
328 | 335 | " * Global optimizer\n", |
329 | 336 | " * Gradient-free\n", |
330 | 337 | "* [FIDES](https://github.com/fides-dev/fides/) (`optimize.FidesOptimizer()`)\n", |
331 | | - " * Interior Trust Region optimizer \n", |
| 338 | + " * Interior Trust Region optimizer\n", |
332 | 339 | "* [Particle Swarm](https://github.com/ljvmiranda921/pyswarms) (`optimize.PyswarmsOptimizer()`)\n", |
333 | 340 | " * Particle swarm algorithm\n", |
334 | 341 | " * Gradient-free\n", |
|
364 | 371 | "source": [ |
365 | 372 | "The following performs 10 multi-start runs with different optimizers in order to compare their performance. For a faster execution of this notebook, we run only 10 starts. In application, one would use many more optimization starts: around 100-1000 in most cases.\n", |
366 | 373 | "\n", |
367 | | - "_Note_: `dlib` and `pyswarm` need to be installed for this section to run. Furthermore, the computation time is in the order of minutes, so you might want to skip the execution and jump to the section on large scale models. " |
| 374 | + "_Note_: `dlib` and `pyswarm` need to be installed for this section to run. Furthermore, the computation time is in the order of minutes, so you might want to skip the execution and jump to the section on large scale models." |
368 | 375 | ] |
369 | 376 | }, |
370 | 377 | { |
|
430 | 437 | "### Optimizer Convergence\n", |
431 | 438 | "\n", |
432 | 439 | "\n", |
433 | | - "A common visualization of optimizer convergence are waterfall plots. Waterfall plots show the (ordered) results of the individual optimization runs. In general, we hope to obtain clearly visible plateaus, as they indicate optimizer convergence to local minima. " |
| 440 | + "A common visualization of optimizer convergence are waterfall plots. Waterfall plots show the (ordered) results of the individual optimization runs. In general, we hope to obtain clearly visible plateaus, as they indicate optimizer convergence to local minima." |
434 | 441 | ] |
435 | 442 | }, |
436 | 443 | { |
|
496 | 503 | "\n", |
497 | 504 | "### Efficient gradient computation\n", |
498 | 505 | "\n", |
499 | | - "As seen in the example above and as can be confirmed from own experience: If fast and reliable gradients can be provided, gradient-based optimizers are favourable with respect to optimizer convergence and run time. \n", |
| 506 | + "As seen in the example above and as can be confirmed from own experience: If fast and reliable gradients can be provided, gradient-based optimizers are favourable with respect to optimizer convergence and run time.\n", |
500 | 507 | "\n", |
501 | 508 | "It has been shown that adjoint sensitivity analysis is a fast and reliable method to compute gradients for large scale models, since their run time is (asymptotically) independent of the number of parameters ([Fröhlich et al. PlosCB 2017](https://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.1005331&type=printable)).\n", |
502 | 509 | "\n", |
503 | | - "<img src=\"https://journals.plos.org/ploscompbiol/article/figure/image?size=large&id=10.1371/journal.pcbi.1005331.g002\" width=\"40%\" alt=\"pyPESTO logo\"/> \n", |
| 510 | + "<img src=\"https://journals.plos.org/ploscompbiol/article/figure/image?size=large&id=10.1371/journal.pcbi.1005331.g002\" width=\"40%\" alt=\"pyPESTO logo\"/>\n", |
504 | 511 | "\n", |
505 | 512 | "(Figure from Fröhlich et al. PlosCB 2017) Adjoint sensitivities are implemented in AMICI." |
506 | 513 | ] |
|
600 | 607 | " problem=problem,\n", |
601 | 608 | " result=result,\n", |
602 | 609 | " optimizer=optimizer_scipy_lbfgsb,\n", |
603 | | - " profile_index=[0, 1],\n", |
604 | 610 | ")" |
605 | 611 | ] |
606 | 612 | }, |
|
639 | 645 | } |
640 | 646 | }, |
641 | 647 | "source": [ |
642 | | - "The plot shows that seven parameters are identifiable, since the likelihood is tightly centered around the optimal parameter. Two parameters (`k_exp_hetero` and `k_imp_homo`) cannot be constrained by the data.\n", |
643 | | - "\n", |
644 | | - "Furthermore pyPESTO allows to visualize confidence intervals directly via" |
| 648 | + "Furthermore, pyPESTO allows to visualize approximate confidence intervals directly via `profile_cis`. Confidence intervals are computed by finding parameter values for which the log posterior ratio is above the approximate threshold assuming a $\\chi^2$ distribution of the likelihood test statistic. The plot shows that both model parameters are identifiable, since the confidence regions are finite and do not span the whole estimation space (from lower to upper estimation boundary)." |
645 | 649 | ] |
646 | 650 | }, |
647 | 651 | { |
|
671 | 675 | "source": [ |
672 | 676 | "### Sampling\n", |
673 | 677 | "\n", |
674 | | - "In pyPESTO, sampling from the posterior distribution can be performed as " |
| 678 | + "In pyPESTO, sampling from the posterior distribution can be performed as" |
675 | 679 | ] |
676 | 680 | }, |
677 | 681 | { |
|
798 | 802 | "source": [ |
799 | 803 | "#### Sampler Choice:\n", |
800 | 804 | "\n", |
801 | | - "Similarly to parameter optimization, pyPESTO provides a unified interface to several sampler/sampling toolboxes, as well as own implementations of sampler:\n", |
| 805 | + "Similarly to parameter optimization, pyPESTO provides a unified interface to several sampler/sampling toolboxes, as well as own implementations of samplers:\n", |
802 | 806 | "\n", |
803 | | - "* Adaptive Metropolis: `sample.AdaptiveMetropolisSampler()`\n", |
804 | | - "* Adaptive parallel tempering: `sample.ParallelTemperingSampler()`\n", |
805 | | - "* Interface to `pymc3` via `sample.Pymc3Sampler()`" |
| 807 | + "* Adaptive Metropolis: `pypesto.sample.AdaptiveMetropolisSampler()`\n", |
| 808 | + "* Parallel tempering: `pypesto.sample.ParallelTemperingSampler()`\n", |
| 809 | + "* Adaptive parallel tempering: `pypesto.sample.AdaptiveParallelTemperingSampler()`\n", |
| 810 | + "* Interface to `pymc` [🔗](https://pypi.org/project/pymc/) via `pypesto.sample.PymcSampler()`" |
806 | 811 | ] |
807 | 812 | }, |
808 | 813 | { |
|
918 | 923 | ], |
919 | 924 | "metadata": { |
920 | 925 | "kernelspec": { |
921 | | - "display_name": "Python 3 (ipykernel)", |
| 926 | + "display_name": "dev_venv_11", |
922 | 927 | "language": "python", |
923 | 928 | "name": "python3" |
924 | 929 | }, |
|
932 | 937 | "name": "python", |
933 | 938 | "nbconvert_exporter": "python", |
934 | 939 | "pygments_lexer": "ipython3", |
935 | | - "version": "3.12.3" |
| 940 | + "version": "3.11.12" |
936 | 941 | } |
937 | 942 | }, |
938 | 943 | "nbformat": 4, |
|
0 commit comments