Skip to main content

A lightweight library that provides regression models of interest to the life sciences.

Project description

Orakel

Orakel is a small Python library of regression models based on NumPy and Scipy.

Purpose

The analysis and evaluation of experimental data are often influenced by artefacts or signal noise. Yet, the observed processes can often be described by mathematical models. Orakel provides implementations of various regression models that are suited for analysing enzyme kinetics and biological processes, such as bacterial growth.

Use

Orakel is intended to be used within a script or processing pipeline.

The following functions are implemented:

  • exponential_decay: exponential decay with optional non-zero asymptote (controlled by boolean flag non_zero_asymptote)
  • double_exponential_decay: double exponential decay with optional non-zero asymptote (controlled by boolean flag non_zero_asymptote)
  • gompertz: Gompertz' generalised logistic function
  • richards: Richards generalised logistic function
  • michaelis_menten: the Michaelis-Menten function
  • schnell_mendoza: explicit form of the Michaelis-Menten equation using Lambert's W function
  • power_function: the power function

For modelling and predictions based on these functions, all except the Schnell-Mendoza function can be used within the class NonlinearRegression. The Schnell-Mendoza function is not implemented as fitting-class, as its numerical complexity makes it particularly difficult to find suitable model parameters automatically without tight constraints.

Orakel is available as package on PyPi and can be installed using a package manager such as pip:

python3 -m pip install orakel

After initialising the class (set non_zero_asymptote=True, to allow for exponential decays with non-zero asymptote), the model is fitted using fit(x, y). The initial parameters and reasonable limits are estimated for each sample automatically. Predictions with the fitted model are made using predict(x_new). As an example, a model for exponential decay is fitted and used for predictions:

import numpy as np

from orakel.predict import exponential_decay, NonlinearRegression

x = np.linspace(0, 3)
y_true = exponential_decay(x, 1, 1.5)

rng = np.random.default_rng()
noise = rng.normal(0, .05, y_true.shape)
y_sample = y_true + noise

model = NonlinearRegression('exponential_decay')
model.fit(x, y_sample)
y_pred = model.predict(x)

While the array for the independent variable must be one-dimensional, the dependent variable can be of shape (n_samples, n_points). The array returned by predict is always of this shape.

Further information

Orakel is primarily the product of personal interest and an attempt to document findings. For this reason, it cannot be considered stable. However, if you find it helpful, you are welcome to use it.

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

orakel-1.0.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orakel-1.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file orakel-1.0.1.tar.gz.

File metadata

  • Download URL: orakel-1.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for orakel-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c3a15a6cf452cc91b13c14775fb36f8bac91909c60e67b5ddc3f7ebb36733e04
MD5 b8971ada166c95088aa88960a3b2858f
BLAKE2b-256 1a9092673f00ff347537e279666ff51fd2ab1dca8302e91236cf4f6ef09359d3

See more details on using hashes here.

File details

Details for the file orakel-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: orakel-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for orakel-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3234136ad6428c5ca70a06a567eb652aa0719561cc6720e420f887234a20683b
MD5 fe05ecaa4370e8b093e3b18181d4c361
BLAKE2b-256 359e55f6b3f0b64fcefb65b570f6a912b3310735b68c3493ee7f6372c77f3420

See more details on using hashes here.

Supported by

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