Welcome to EPI’s documentation!
EPI - Euler Parameter Inference
Euler Parameter Inference (EPI) is a Python package for inverse parameter inference. It provides an implementation of the EPI algorithm, which takes observed data and a model as input and returns a parameter distribution consistent with the observed data by solving the inverse problem directly. In the case of a one-to-one mapping, this is the true underlying distribution.
Features
EPI supports
SBML ode models
User provided models
Models with automatic differentation using jax
Installation
The package is available on pypi and can be installed with:
pip install eulerpi
or
pip install eulerpi[sbml]
for the support of sbml models.
Make sure that you have the following C++ libraries installed:
sudo apt install -y swig libblas-dev libatlas-base-dev libhdf5-dev
You can also build the library from the latest source code by following the Development Quickstart Guide.
How to start
To use EPI, derive your model from the Model class and implement the abstract functions. Here’s an example code snippet:
# my_model.py
import jax.numpy as jnp
from eulerpi.core.model import Model
class MyModel(Model):
param_dim = N # The dimension of a parameter point
data_dim = M # The dimension of a data point
def forward(self, param):
return jnp.array(...)
def jacobian(self, param):
return jnp.array(...)
To evaluate the model and infer the parameter distribution, call:
from eulerpi.core.inference import inference
from my_model import MyModel
# This line is needed for multiprocessing in python
if __name__ == "__main__":
central_param = np.array([0.5, -1.5, ...])
param_limits = np.array([[0.0, 1.0], [-3.0, 0.0], ...])
model = MyModel(central_param, param_limits)
inference(model=model, data="my_data.csv")
The parameter data
can be a numpy-2d-array or a PathLike object that points to a CSV file. In the example shown above, the CSV file my_data.csv
should contain the data in the following format:
datapoint_dim1, datapoint_dim2, datapoint_dim3, ..., datapoint_dimN
datapoint_dim1, datapoint_dim2, datapoint_dim3, ..., datapoint_dimN
datapoint_dim1, datapoint_dim2, datapoint_dim3, ..., datapoint_dimN
...
datapoint_dim1, datapoint_dim2, datapoint_dim3, ..., datapoint_dimN
This corresponds to a matrix with the shape nSamples
x data_dim
. For more available options and parameters for the inference
method, please refer to the API documentation.
Note that the inference can be done with grid-based methods (dense grids, sparse grids) or sampling methods (mcmc).
The results are stored in the following locations
./Applications/<ModelName>/.../OverallParams.csv
./Applications/<ModelName>/.../OverallSimResults.csv
./Applications/<ModelName>/.../OverallDensityEvals.csv
These files contain the sampled parameters, the corresponding data points obtained from the model forward pass, and the corresponding density evaluation.
Note
Please read the documentation for our Examples.
- Core API
- Tutorial
- Example Models
- Development
- Contributing to EPI
- LICENSE
- Citation
- Changelog
- [Template]
- [Unreleased]
- [0.9.1] - 2024-09-08
- [0.9.0] - 2024-05-31
- [0.8.1] - 2024-05-31
- [0.8.0] - 2024-03-21
- [0.7.0] - 2023-11-03
- [0.6.1] - 2023-11-02
- [0.6.0] - 2023-11-02
- [0.5.0] - 2023-07-20
- [0.4.0] - 2023-06-24
- [0.3.1] - 2023-05-02
- [0.3.0] - 2023-04-27
- [0.2.1] - 2023-04-21
- [0.2.0] - 2023-04-20
- [0.1.5] - 2023-04-06
- [0.1.4] - 2023-04-06
- [0.1.3] - 2023-04-05
- [0.1.2] - 2023-04-05
- [0.1.1] - 2023-04-05
- [0.1.0] - 2023-04-05