Kernel Density Estimation accelerated with Fast Fourier Transform and JAX (JIT+GPU support+AD).
Features
-
FFT-accelerated KDE (inspired by KernelDensity.jl):
fft_kde1d: 1D KDE with FFT convolution (requires regular grid)fft_kde2d: 2D KDE with FFT convolution (requires regular grid)fft_kde3d: 3D KDE with FFT convolution (requires regular grid)
The KDE can be evaluated on non-regular grid by interpolation, such as
jax.numpy.interporjax.scipy.interpolate.RegularGridInterpolator -
Binned-accelerated implementation:
binned_kde1d: 1D KDE with data binning
-
Bandwidth estimators:
- Scott's rule (
scott_bw1d/2d/3d) - Silverman's rule (
silverman_bw1d/2d/3d)
- Scott's rule (
Installation
-
Install JAX following the instructions at: https://github.com/jax-ml/jax, e.g
pip install "jax[cpu]" # For CPU-only version
or
pip install "jax[cuda12]" # For GPU support (CUDA)
-
Install with
pippip install KDExpress
-
Alternative way:
-
Clone the
KDExpressrepogit clone https://github.com/mtagliazucchi/KDExpress
-
Install the code
a. Editable install:
cd KDExpress pip install -e .
b. Or use it ad-hoc:
import sys; sys.path.append("/path/to/KDExpress") from KDExpress import fft_kde1d
-
Usage and benchmarks
See the examples folder.
License
MIT © Matteo Tagliazucchi
Metadata
Release files for KDExpress 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kdexpress-0.2.1.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kdexpress-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / kdexpress-0.2.1.tar.gz
| Download URL | kdexpress-0.2.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08e5bdb09d35f3a2e8c0c1088d8e2f5cbb99da705aee77210909de393c89348a
|
|
BLAKE2b-256 checksum How to use checksums |
d761b09487fa393cd0fe18f06a391e885eaf8ed53ea344da2f6985fe16648872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.18
|
Release files / kdexpress-0.2.1-py3-none-any.whl
| Download URL | kdexpress-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58a80315caa3f1d7f40705ba4199e0ae2d937ed4833c47c163bb5ecab8b25826
|
|
BLAKE2b-256 checksum How to use checksums |
55dc037be376cf540b8762015fa506e8daee69e49df2ae85a55ebc28cea8d08b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.18
|