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.2
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.2.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kdexpress-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / kdexpress-0.2.2.tar.gz
| Download URL | kdexpress-0.2.2.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
254a391ceed68aab9ab948f39d4860c3c0f0970d83e01346214e3e8ba7f459a3
|
|
BLAKE2b-256 checksum How to use checksums |
fe9151e144b2cc378e8bfc7bf74a12ca9bd821a4743cd42bbf08659869778031
|
| 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.2-py3-none-any.whl
| Download URL | kdexpress-0.2.2-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f3f4c289b0eecf519107d50ff9b8aacc496562059d19c4f73494a0ce994f24c
|
|
BLAKE2b-256 checksum How to use checksums |
6c73ba1ac3d43e7d411f95bdac97fe03b1f7457c9645711be5afa36f88329858
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.18
|