Bayesian Learning of Kernel Embeddings

Seth R. Flaxman, Dino Sejdinovic, John P. Cunningham, Sarah Filippi

Abstract

Kernel mean embeddings represent probability distributions as points in a high-dimensional Reproducing Kernel Hilbert Space (RKHS). While effective, these methods are notoriously sensitive to kernel hyperparameters, particularly in unsupervised settings where cross-validation is unavailable. This paper introduces the Bayesian Kernel Embedding (BKE) framework, which places a Gaussian Process prior over the embedding. This allows for principled hyperparameter optimization through a closed-form marginal pseudolikelihood, significantly outperforming standard heuristics like the "median heuristic" in tasks such as hypothesis testing and causal discovery.

Introduction

Kernel methods are fundamental in non-parametric statistics, enabling tasks like two-sample testing and independence testing. The kernel mean embedding is central to these methods, but its reliance on manually tuned hyperparameters—like the bandwidth—is a significant weakness. In the absence of a supervised loss function, the "median heuristic" is commonly used but often fails to capture the relevant scales of the data. This work addresses this gap by casting kernel embedding estimation as a Bayesian inference problem.

The Bayesian Kernel Embedding (BKE) Framework

The authors propose treating the mean embedding $\mu(x)$ as a latent function with a Gaussian Process (GP) prior. To ensure the prior is well-defined within the RKHS, they employ a specific covariance structure ($r_\theta$). By defining a conjugate likelihood that links the true mean embedding to the empirical mean estimator (motivated by the Central Limit Theorem), they derive a full posterior distribution for the embedding.

The Bayesian framework: (A) draws from the GP prior, (B) the empirical mean estimate, and (C) the resulting posterior distribution with uncertainty quantification.

This Bayesian approach provides two key advantages:

  1. Uncertainty Quantification: It offers a posterior distribution rather than a point estimate, allowing for uncertainty assessment in the "witness function" (the difference between embeddings).
  2. Shrinkage as a Posterior Mean: The posterior mean naturally incorporates shrinkage, providing a Bayesian justification for frequentist regularization techniques.

Bayesian Kernel Learning (BKL)

The primary contribution is a principled method for hyperparameter selection called Bayesian Kernel Learning (BKL). Because the model is conjugate, the authors derive a closed-form marginal pseudolikelihood. Maximizing this objective allows for the automatic discovery of optimal kernel parameters, such as lengthscales, directly from the data. This serves as a superior "drop-in" replacement for the median heuristic.

Experimental Results

The BKL method was evaluated against the median heuristic across several benchmarks. In a "Grid of Gaussians" two-sample test, BKL successfully identified differences in distribution where the median heuristic failed completely.

Performance on the Grid of Gaussians: (C) shows BKL achieving near-zero Type II error while the median heuristic fails. (D) illustrates the marginal log-likelihood identifying the correct data scale (BKL) vs. the sub-optimal median heuristic.

In real-world applications, BKL was applied to the Ozone dataset for causal structure discovery. Using the PC algorithm, BKL correctly identified the causal link from Temperature to Ozone, a relationship missed by previous state-of-the-art methods relying on standard heuristics.

Discussion and Limitations

While BKL provides a robust alternative to heuristics, it introduces computational challenges. The matrix inversions required for the marginal likelihood lead to $O(n^3)$ complexity, limiting its direct application to very large datasets. Future work aims to integrate scalable GP approximations, such as Random Fourier Features or Nyström methods, to extend BKL to big data regimes.

Conclusion

By moving from point estimation to a Bayesian framework, this work provides a theoretically grounded and practically superior method for learning kernel embeddings. BKL eliminates the need for sub-optimal heuristics, offering a principled approach that enhances the power and reliability of kernel-based unsupervised learning.

Summary updated

BibTeX
@inproceedings{flaxman2016bayesian,
  author = {Seth R. Flaxman and Dino Sejdinovic and John P. Cunningham and Sarah Filippi},
  title = {{Bayesian Learning of Kernel Embeddings}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2016},
  url = {https://openreview.net/forum?id=o3Nvlhg410},
}
Figure