Skip to main content

Fast Kernel Density Estimation with FFT and JAX

Project description

KDExpress Logo

Kernel Density Estimation accelerated with Fast Fourier Transform and JAX (JIT+GPU support+AD).

License: MIT Python JAX

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.interp or jax.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)

Installation

  1. 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)
    
  2. Install with pip

    pip install KDExpress
    
  3. Alternative way:

    • Clone the KDExpress repo

      git 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kdexpress-1.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kdexpress-1.0.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

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

Hashes for kdexpress-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a8d42d2a4833334ae6dc897b5227d7b090b7c79d11bbd71b06923bdffa91c5f6
MD5 984f80a6bd4489269e01a366f0f8df07
BLAKE2b-256 d5c550e9c6b79b1cd9c8965aec380e5f0c85cfdd03f07637d396cbd980224614

See more details on using hashes here.

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

Hashes for kdexpress-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9e986ccda8fb53896f1ff0d6e72a269f0d1a9a516a0866c470b673e34dd0f4
MD5 b010ec733de7b62a3f9488863d2303e5
BLAKE2b-256 c78d0b51d4c38de5be02fc7fc552d8c31de9ffb637245a039318df00d9bef7af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page