Skip to main content

The eulerian parameter inference (eulerpi) returns a parameter distribution, which is 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.

Project description

EPI

pages-build-deployment Build & Publish Documentation Publish to PyPI pytest

flake8 black License: MIT Python PyPI

Eulerian Parameter Inference (EPI) is a powerful and novel method for inverse model parameter inference. The eulerpi package 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 case the model describes a one-to-one mapping between parameters and simulation results, the inferred parameter distribution is the true underlying distribution.

Documentation

The full documentation of this software, including a detailed tutorial on how to use EPI and the api documentation, can be found under Documentation.

Features

EPI supports

  • SBML ode models
  • User provided models
  • Models with automatic differentiation 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.

Using the library

To use EPI, derive your model from the BaseModel class and implement the abstract functions. Here's an example code snippet:

# my_model.py

import jax.numpy as jnp

from eulerpi.core.models import BaseModel

class MyModel(BaseModel):

    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.sampling 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 data argument 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 location:

  • ./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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eulerpi-0.10.0.tar.gz (57.9 kB view details)

Uploaded Source

Built Distribution

eulerpi-0.10.0-py3-none-any.whl (73.1 kB view details)

Uploaded Python 3

File details

Details for the file eulerpi-0.10.0.tar.gz.

File metadata

  • Download URL: eulerpi-0.10.0.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for eulerpi-0.10.0.tar.gz
Algorithm Hash digest
SHA256 5dee9666d6c2df1add618a9f1a75f37a76dd4211e8770435da02c39e8d8c43e0
MD5 08dec0d14e1b209e940ac7ba46921b15
BLAKE2b-256 f0b6014911aa4531c6b337e6f06bc13716d637f0ac649d699ac9d905d7db914e

See more details on using hashes here.

File details

Details for the file eulerpi-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: eulerpi-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 73.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for eulerpi-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1430ad6abf9ee268a23d0e8734b771de039cc472b7e4b982c69118fea8c2d95e
MD5 7c8acef6d2915322233da2b7d102c047
BLAKE2b-256 7f6cc5cc1f4d6f77371a28f82bff0c74a6a75f8a831859d8310fe46c8312103f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page