Probabilistic numerical finite differences
Project description
probfindiff: Probabilistic numerical finite differences.
Traditional finite difference schemes are great, but let's look at the whole picture.
Why?
Because when using traditional finite difference coefficients, one implicitly assumes that the function to-be-differentiated is a polynomial. Is your function really a polynomial? If not, read on.
Getting started
Installation:
pip install .
With all dev-related setups
pip install .[ci]
Background
The technical background is explained in the paper:
@article{kramer2021probabilistic,
title={Probabilistic Numerical Method of Lines for Time-Dependent Partial Differential Equations},
author={Kr{\"a}mer, Nicholas and Schmidt, Jonathan and Hennig, Philipp},
journal={AISTATS},
year={2021}
}
Please consider citing it if you use this repository for your research.
Related work finite difference methods
Finite difference schemes are not new, obviously.
Python
- FinDiff (https://findiff.readthedocs.io/en/latest/)
- pystencils (https://pycodegen.pages.i10git.cs.fau.de/pystencils/index.html#)
- FDM (https://github.com/wesselb/fdm)
- RBF(.fd) (https://rbf.readthedocs.io/en/latest/fd.html)
Julia
- FiniteDifferences.jl (https://github.com/JuliaDiff/FiniteDifferences.jl)
- FinDiff.jl (https://github.com/JuliaDiff/FiniteDiff.jl)
Distinction
pnfindiff
does many things similarly to the above, but differs in more than one points:
- We do probabilistic numerical finite differences.
Essentially, this encompasses a Gaussian process perspective
on radial-basis-function-generated finite differences (provided by "RBF" above).
As such, different to all of the above, we treat uncertainty quantification and modelling
as first-class-citizens. In some sense, PN finite differences generalise
traditional schemes (for specific kernels and grids), which is easily accessible
in
pnfindiff
's implementation, but a few flavours of methods are different because of the probability theory. pnfindiff
uses JAX, which brings with it automatic differentiation, JIT-compilation, GPUs, and more.pnfindiff
does not evaluate functions. There is also no internal state. Finite difference schemes are plain tuples of coefficient vectors, and not callables that call the to-be-differentiated function. This is more efficient (schemes are reused; functions are easy to JIT-compile; we cannot call your function more efficiently than you can), more transparent (we do not recompute stencils for new points, because we only provide coefficient vectors), and implies fewer corner cases ("Have you provided a vectorised function?"; "What if my data is hand-gathered or points to some weird black-box-simulator?").
At the time of writing, there has been much more work on the packages above than on pnfindiff
(which clearly shows -- they're all great and have been big inspiration for this package!), so
interfaces may be more stable with the other packages for now.
Numerical stability may also not be where it could be.
Therefore, choose your package with these thoughts in mind.
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 Distributions
Built Distribution
File details
Details for the file probfindiff-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: probfindiff-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa1d87d7a49d9b23e687cbbc8cf47df366f292104145d8c8a977c98edd4a6d20 |
|
MD5 | f596da1ec2953ddee7802677e2cf310e |
|
BLAKE2b-256 | 91c8e69921f9a9aa855c2d8dd78c2ce278d43c7a3e284097618c6f8bc6cc80c5 |