Skip to content

Code implementation of kernel quantile discrepancies (KQDs) based on kernel quantile embeddings (KQEs).

License

Notifications You must be signed in to change notification settings

MashaNaslidnyk/kqe

Repository files navigation

KQE: Kernel Quantile Embeddings and Discrepancies

A Python library for computing Kernel Quantile Discrepancies (KQDs) based on Kernel Quantile Embeddings (KQEs), proposed in PAPER.

Features

  • Main module: kqd
  • Backends: Built on JAX for accelerated, differentiable computations.
  • Experiments: Experiments from the PAPER are implemented in the experiments/ folder.

Installation

1. Clone the repository

git clone https://github.com/mashanaslidnyk/kqe.git
cd kqe

2. Install the package

  • 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

Quick Start

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)

Testing & Formatting

To run pytest tests:

make test

To format everything with black and isort:

make format

License

This project is licensed under the GNU GPLv3. See the LICENSE file for details.

About

Code implementation of kernel quantile discrepancies (KQDs) based on kernel quantile embeddings (KQEs).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published