Skip to content

Code for the NeurIPS 2021 paper "Higher Order Kernel Mean Embeddings to Capture Filtrations of Stochastic Processes".

Notifications You must be signed in to change notification settings

maudl3116/higherOrderKME

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Higher Order Kernel Mean Embeddings for Stochastic Processes

This library provides estimators for the first and second order Maximum Mean Discrepancies (MMDs) with GPU support.

Installation

pip install git+https://github.com/maudl3116/higherOrderKME.git

Structure of the repository

  • The higherOrderKME folder contains the implementation of the higher order MMDs (see sigkernel.py) and higher order distribution regression algorithms (see KES.py)
  • The examples folder contains notebooks to perform two-sample tests, higher order distribution regression and causal graph discovery for stochastic processes.
  • The data folder contains the data generators used for the experiments in the paper:

How to use the library

import torch
from higherOrderKME import sigkernel

# Specify the static kernel (for linear kernel use sigkernel.LinearKernel())
static_kernel = sigkernel.RBFKernel(sigma=0.5)

# Specify dyadic order for PDE solver (int > 0, default 0, the higher the more accurate but slower)
dyadic_order = 2

# Specify the hyperparameter for the estimation of the conditional KME
lambda_ = 1e-5

# Initialize the corresponding signature kernel
signature_kernel = sigkernel.SigKernel(static_kernel, dyadic_order)

# Synthetic data
n, len_x, len_y, dim = 100, 10, 20, 2
x = torch.rand((n,len_x,dim), dtype=torch.float64, device='cuda') # shape (batch,len_x,dim)
y = torch.rand((n,len_y,dim), dtype=torch.float64, device='cuda') # shape (batch,len_y,dim)

# Compute the (classical) first order MMD distance between samples x ~ P and samples y ~ Q, where P,Q are two distributions on path space
mmd_order1 = signature_kernel.compute_mmd(x, y, order=1)

# Compute the second order MMD distance between samples x ~ P and samples y ~ Q, where P,Q are two distributions on path space
mmd_order2 = signature_kernel.compute_mmd(x, y, lambda_=lambda_, order=2)

Citation

@article{salvi2021higher,
  title={Higher Order Kernel Mean Embeddings to Capture Filtrations of Stochastic Processes},
  author={Salvi, Cristopher and Lemercier, Maud and Liu, Chong and Hovarth, Blanka and Damoulas, Theodoros and Lyons, Terry},
  journal={arXiv preprint arXiv:2109.03582},
  year={2021}
}

About

Code for the NeurIPS 2021 paper "Higher Order Kernel Mean Embeddings to Capture Filtrations of Stochastic Processes".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages