Skip to main content

Gaussianprocessderivatives

A Python package for smoothing data and estimating first- and second-order derivatives and their errors. Covariance functions can be linear, squared exponential, squared exponential with a linear trend, twice-differentiable Matern, periodic, and locally periodic.

Example

An example workflow to smooth data (x, y), where the columns of y are replicates, is

>>> import gaussianprocessderivatives as gp
>>> g = gp.maternGP({0: (-4, 4), 1: (-4, 4), 2: (-4, -2)}, x, y)

The dictionary sets bounds on the hyperparameters, so that 0: (-4, 4) means that the bounds on the first hyperparameter are 1e-4 and 1e4.

The amplitude and measurement-error hyperparameters are variances of y, so their bounds depend on the magnitude of the data. Passing scale_y=True divides y by its root mean square before fitting while restoring the units of the data in every prediction and sample, so that one set of bounds serves data of most scales. The hyperparameters are relative to the root-mean-square scale.

>>> g.info()

explains what each hyperparameter does.

Once g is instantiated,

>>> g.findhyperparameters()
>>> g.results()
>>> g.predict(x, derivs=2)

optimises the hyperparameters, determines a smoothed version of the data, and estimates the derivatives.

The results can be visualised by

>>> import matplotlib.pylab as plt
>>> plt.figure()
>>> plt.subplot(2, 1, 1)
>>> g.sketch('.')
>>> plt.subplot(2, 1, 2)
>>> g.sketch('.', derivs=1)
>>> plt.show()

and are available as g.f and g.fvar (smoothed data and error), g.df and g.dfvar (estimate of dy/dx), and g.ddf and g.ddfvar (estimate of d2y/dx2).

Citation

If you find the software useful, please consider citing:

Swain, P. S., Stevenson, K., Leary, A., Montano-Gutierrez, L. F., Clark, I. B. N., Vogel, J., & Pilizota, T. (2016). Inferring time derivatives including cell growth rates using Gaussian processes. Nature Communications, 7, 13766.

Development history

  • v0.2.0: Each covariance function became a class of its own; only for python 3.11; warnings from the Gaussian process are optional.
  • v0.3.0: scale_y introduced; the random-number generator now belongs to the instance, not to the module; a pytest suite added.

Metadata

Release files for gaussianprocessderivatives 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gaussianprocessderivatives 0.3.0
File Size Uploaded
gaussianprocessderivatives-0.3.0.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gaussianprocessderivatives 0.3.0
File Interpreter ABI Platform
gaussianprocessderivatives-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.8 kB

Release files / gaussianprocessderivatives-0.3.0.tar.gz

Download URL gaussianprocessderivatives-0.3.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d098883b0e4a11f50f178ed274163039b1f5b970ec8e2ce52461ae477a4d961
BLAKE2b-256 checksum
How to use checksums
6380a618f81166f64e41e422cd765768a9fad479a3c32b20f7856b973727bb58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.3 Darwin/25.6.0

Release files / gaussianprocessderivatives-0.3.0-py3-none-any.whl

Download URL gaussianprocessderivatives-0.3.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
210636d2d4f632d252fb4e84aae89ab854e67e752cd7cad3dcc5bc1238219de4
BLAKE2b-256 checksum
How to use checksums
1da9bd5e35a6d61fc28ec11f8cae1beb223001786bbc13d6716c25815c7e4f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.3 Darwin/25.6.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.67

2 release files

0.1.66

2 release files

0.1.65

2 release files

0.1.64

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page