A Python library for computing Kernel Quantile Discrepancies (KQDs) based on Kernel Quantile Embeddings (KQEs), proposed in PAPER.
- Main module:
kqd - Backends: Built on JAX for accelerated, differentiable computations.
- Experiments: Experiments from the PAPER are implemented in the
experiments/folder.
git clone https://github.com/mashanaslidnyk/kqe.git
cd kqe-
Editable mode (recommended for development):
make dev-install
-
Editable mode that also allows you run experiments:
To install in editable mode, and also install dependencies required to run the experiments in the
experiments/folder:make dev-install-experiments
-
Standard install:
make install
import jax.numpy as jnp
from kqe.kernels import GaussianKernel
from kqe.kqd import ekqd
# Sample data
X = jnp.array([[1.0], [2.0], [3.0]])
Y = jnp.array([[1.5], [2.5], [3.5]])
# Kernel
k = GaussianKernel(l=1.0)
# Compute e-KQD²
ekqd_val = ekqd(X, Y, kernel_fn=k, num_projections=3)
print("eKQD²:", ekqd_val)To run pytest tests:
make testTo format everything with black and isort:
make formatThis project is licensed under the GNU GPLv3. See the LICENSE file for details.