The release introduces various new features and redesigns to improve the functionality of `pymob`. The package now supports to specify hierarchical models with the config backend and to estimate parameters with numpyro.
Currently the package mainly focuses on numpyro, which at this time implements the widest functionality. In future versions, feature support for additional inference engines will be expanded
Currently supported algorithms and planned features
| Backend | Supported Algorithms | Inference | Hierarchical Models |
| :--- | --- | --- | --- |
| `numpyro` | Markov Chain Monte Carlo (MCMC), Stochastic Variational Inference (SVI) | ✅ | ✅ |
| `pymoo` | (Global) Multi-objective optimization | ✅ | plan |
| `pyabc` | Approximate Bayes | ✅ | plan |
| `scipy` | Local optimization (`minimize`) | dev | plan |
| `pymc` | MCMC | plan | plan |
| `sbi` | Simulation Based Inference (in planning) | hold | hold |
| `interactive ` | interactive backend in jupyter notebookswith parameter sliders | ✅ | plan |
Breaking changes
- Case study import from package. The previous architecture of case studies was clumsy and had frustrating behavior under various usage scenarios. In release 0.5.0 the design decision was made to require case studies to be installed as editable installs with `pip install -e CASE_STUDY`. This permanently adds the paths to the modules of the case study to the PYTHONPATH and thus makes use of the case studies possible from anywhere and get rid of annoying warnings. In addition, this choice will make case studies interoperable, meaning that Simulations of case studies can now easily be used to serve as parent classes for other case studies. While the previous methods of importing case studies (dynamic updating of sys.path to resolve the paths to the modules) continue to be supported in this version, support will be dropped in future versions.
- API Change: Evaluator dispatch, Feature: allow variable dimensional x_in and y0 by flo-schu in https://github.com/flo-schu/pymob/pull/78
New features
Implement infrastructure and tools for hierarchical modeling in PR https://github.com/flo-schu/pymob/pull/82 by flo-schu
- Implement loglikelihood and gradient checkers for numpyro by flo-schu in https://github.com/flo-schu/pymob/pull/75
- Rigorous dimensional tests in the Evaluator and `diffrax` Solver to make sure dimensions are correctly specified before evaluating a model
- Default posterior predictive checks in numpyro
- Default prior and posterior predictive checks in numpyro
- Likelihood landscapes. Works currently only for 2-D parameters
- Specification of priors with indexing variables to formulate hierarchical models
- implement experimental scipy backend for simple model fitting (Work in progress, sampling from priors is possible, inference not yet implemented)
- Support for truncated distributions in numpyro with the `low` and `high` keywords `alpha = value=0.5 min=0.1 max=5.0 prior=lognorm(s=0.1,scale=0.50,high=5) free=True`. In the future this will be developed to integrate with bounds specification (min/max) by flo-schu in https://github.com/flo-schu/pymob/pull/110
Reporting: Pymob now supports automatized report generation and reporting of parameter estimates 123 by flo-schu
Further reports will be added in future releases, e.g.:
+ NRMSE
+ BIC, AIC
+ Model discrepancy/inadequacy measures
By default, `pymob-infer` creates a report which is configurable via the `config.report` section. It can also be created in a script, with `from pymob.sim.report import Report; report = Report(config=sim.config)`. Then, a number of reports are possible, which write to a file in the `config.case_study.output_path` and return the path of the file.
Major documentation update! 122 by flo-schu
- Improved quickstart guide
- Added information about package structure and inference capabilities

- Preparation for doctesting (will be automated in 0.5.1)
- Outsourced case study testing to case studies
- Added examples from case studies as executed jupyter notebooks, to ensure integration of pymob with case studies
- Parameterized testing: Pymob now starts to exploit `pytest` parameterization and fixtures to test the package with a wide selection and combination of configuration options. This will be expanded in future releases
Details and Bug Fixes
- Resolved various linting errors and improved test reliability by fixing package handling errors and refining error messages in multiple functions
- Fixed bugs in prediction utilities and handling parameters in solvers, ensuring that all edge cases, like empty likelihood dictionaries, are addressed.
- Add commandline interface for modifying config files by flo-schu in https://github.com/flo-schu/pymob/pull/107
- Add index to posterior by flo-schu in https://github.com/flo-schu/pymob/pull/106
- fix multichain numpyro idata bug by flo-schu in https://github.com/flo-schu/pymob/pull/111
- Implement an experimental symbolic solver class for solving simple ODE models analytically and providing the solution as latex and python code by flo-schu in https://github.com/flo-schu/pymob/pull/81
New case studies
Since this version, case studies are published as regular Python packages. This means case studies subclass `pymob.SimulationBase` and override methods or provide their own methods to extend pymob for use-case specific requirements. As a growing suite of self documented examples, the case studies are openly made available and will be (in very near future) also tested as part of a larger integration testing to ensure that newly implemented pymob features are also weather-proof with respect to more complex simulation and estimation tasks and don't break existing case-studies.
- TKTD RNA Pulse: https://github.com/flo-schu/tktd_rna_pulse, a TKTD model that integrates nrf2 expression data to approximate damage after exposure to chemicals and before death.
- Lotka-Volterra Case study: https://github.com/flo-schu/lotka_volterra_case_study, the classic example of population dynamics. This example serves as the test case for many pymob tests and is also a simple example into modelling with pymob
Full Changelog
https://github.com/flo-schu/pymob/compare/0.4.1...0.5.0