Uses Gaussian processes to smooth data and estimate first- and second-order derivatives
Project description
A Python package for smoothing data and estimating first- and second-order derivatives and their errors.
Covariance functions can either be linear, squared exponential, neural network-like, or squared exponential with a linear trend.
An example workflow to smooth data (x, y), where the columns of y are replicates, is
>>> import gaussian process 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.
>>> g.info()
explains what each hyperparameter does.
Once g is instantiated,
>>> g.findhyperparameters()
>>> g.results()
>>> g.predict(x, derivs= 2)
optimises the hyperparameters and 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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gaussianprocessderivatives-0.1.65.tar.gz
.
File metadata
- Download URL: gaussianprocessderivatives-0.1.65.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.0 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2e3d99d113a1dcf481dffb1193b78579f3a0918a1094e45b5bb152e709818ce |
|
MD5 | c652ecf7f5cde0c22f283ae6ebbe182d |
|
BLAKE2b-256 | 6e9c96e5a5e85ed46a776f64b7ca59f2c28501fadd5f41de6202876ef7904908 |
File details
Details for the file gaussianprocessderivatives-0.1.65-py3-none-any.whl
.
File metadata
- Download URL: gaussianprocessderivatives-0.1.65-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.0 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab9280f08bf2a7486972bdd22b495cac4a069ee4e1c6b2a6f0eb84eae01ef548 |
|
MD5 | 6eca853a2e4dd743ddcb3f3644e2fc1d |
|
BLAKE2b-256 | c31e146aa0ea1f04a0ad41cead7b6877a7934dcbb70372d52b8d0f0596c583d5 |