Fast Kernel Density Estimation with FFT and JAX
Project description
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kdexpress-1.0.1.tar.gz.
File metadata
- Download URL: kdexpress-1.0.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d42d2a4833334ae6dc897b5227d7b090b7c79d11bbd71b06923bdffa91c5f6
|
|
| MD5 |
984f80a6bd4489269e01a366f0f8df07
|
|
| BLAKE2b-256 |
d5c550e9c6b79b1cd9c8965aec380e5f0c85cfdd03f07637d396cbd980224614
|
File details
Details for the file kdexpress-1.0.1-py3-none-any.whl.
File metadata
- Download URL: kdexpress-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c9e986ccda8fb53896f1ff0d6e72a269f0d1a9a516a0866c470b673e34dd0f4
|
|
| MD5 |
b010ec733de7b62a3f9488863d2303e5
|
|
| BLAKE2b-256 |
c78d0b51d4c38de5be02fc7fc552d8c31de9ffb637245a039318df00d9bef7af
|