Kernel embedding of distributions


In machine learning, the kernel embedding of distributions comprises a class of nonparametric methods in which a probability distribution is represented as an element of a reproducing kernel Hilbert space . A generalization of the individual data-point feature mapping done in classical kernel methods, the embedding of distributions into infinite-dimensional feature spaces can preserve all of the statistical features of arbitrary distributions, while allowing one to compare and manipulate distributions using Hilbert space operations such as inner products, distances, projections, linear transformations, and spectral analysis. This learning framework is very general and can be applied to distributions over any space on which a sensible kernel function may be defined. For example, various kernels have been proposed for learning from data which are: vectors in, discrete classes/categories, strings, graphs/networks, images, time series, manifolds, dynamical systems, and other structured objects. The theory behind kernel embeddings of distributions has been primarily developed by , , , and Bernhard Schölkopf. A review of recent works on kernel embedding of distributions can be found in.
The analysis of distributions is fundamental in machine learning and statistics, and many algorithms in these fields rely on information theoretic approaches such as entropy, mutual information, or Kullback–Leibler divergence. However, to estimate these quantities, one must first either perform density estimation, or employ sophisticated space-partitioning/bias-correction strategies which are typically infeasible for high-dimensional data. Commonly, methods for modeling complex distributions rely on parametric assumptions that may be unfounded or computationally challenging, while nonparametric methods like kernel density estimation or characteristic function representation break down in high-dimensional settings.
Methods based on the kernel embedding of distributions sidestep these problems and also possess the following advantages:
  1. Data may be modeled without restrictive assumptions about the form of the distributions and relationships between variables
  2. Intermediate density estimation is not needed
  3. Practitioners may specify the properties of a distribution most relevant for their problem
  4. If a characteristic kernel is used, then the embedding can uniquely preserve all information about a distribution, while thanks to the kernel trick, computations on the potentially infinite-dimensional RKHS can be implemented in practice as simple Gram matrix operations
  5. Dimensionality-independent rates of convergence for the empirical kernel mean to the kernel embedding of the true underlying distribution can be proven.
  6. Learning algorithms based on this framework exhibit good generalization ability and finite sample convergence, while often being simpler and more effective than information theoretic methods
Thus, learning via the kernel embedding of distributions offers a principled drop-in replacement for information theoretic approaches and is a framework which not only subsumes many popular methods in machine learning and statistics as special cases, but also can lead to entirely new learning algorithms.

Definitions

Let denote a random variable with domain and distribution Given a kernel on the Moore–Aronszajn theorem asserts the existence of a RKHS in which the element satisfies the reproducing property
One may alternatively consider an implicit feature mapping from to , so that can be viewed as a measure of similarity between points While the similarity measure is linear in the feature space, it may be highly nonlinear in the original space depending on the choice of kernel.

Kernel embedding

The kernel embedding of the distribution in is given by:
If allows a square integrable density, then, where is the Hilbert–Schmidt integral operator. A kernel is characteristic if the mean embedding is injective. Each distribution can thus be uniquely represented in the RKHS and all statistical features of distributions are preserved by the kernel embedding if a characteristic kernel is used.

Empirical kernel embedding

Given training examples drawn independently and identically distributed from the kernel embedding of can be empirically estimated as

Joint distribution embedding

If denotes another random variable, then the joint distribution can be mapped into a tensor product feature space via
By the equivalence between a tensor and a linear map, this joint embedding may be interpreted as an uncentered cross-covariance operator from which the cross-covariance of mean-zero functions can be computed as
Given pairs of training examples drawn i.i.d. from, we can also empirically estimate the joint distribution kernel embedding via

Conditional distribution embedding

Given a conditional distribution one can define the corresponding RKHS embedding as
Note that the embedding of thus defines a family of points in the RKHS indexed by the values taken by conditioning variable. By fixing to a particular value, we obtain a single element in, and thus it is natural to define the operator
which given the feature mapping of outputs the conditional embedding of given Assuming that for all it can be shown that
This assumption is always true for finite domains with characteristic kernels, but may not necessarily hold for continuous domains. Nevertheless, even in cases where the assumption fails, may still be used to approximate the conditional kernel embedding and in practice, the inversion operator is replaced with a regularized version of itself .
Given training examples the empirical kernel conditional embedding operator may be estimated as
where are implicitly formed feature matrices, is the Gram matrix for samples of, and is a regularization parameter needed to avoid overfitting.
Thus, the empirical estimate of the kernel conditional embedding is given by a weighted sum of samples of in the feature space:
where and

Properties

This section illustrates how basic probabilistic rules may be reformulated as linear algebraic operations in the kernel embedding framework and is primarily based on the work of Song et al. The following notation is adopted:
In practice, all embeddings are empirically estimated from data and it assumed that a set of samples may be used to estimate the kernel embedding of the prior distribution.

Kernel sum rule

In probability theory, the marginal distribution of can be computed by integrating out from the joint density
The analog of this rule in the kernel embedding framework states that the RKHS embedding of, can be computed via
where is the kernel embedding of In practical implementations, the [|kernel sum rule] takes the following form
where
is the empirical kernel embedding of the prior distribution, , and are Gram matrices with entries respectively.

Kernel chain rule

In probability theory, a joint distribution can be factorized into a product between conditional and marginal distributions
The analog of this rule in the kernel embedding framework states that the joint embedding of can be factorized as a composition of conditional embedding operator with the auto-covariance operator associated with
where
In practical implementations, the [|kernel chain rule] takes the following form

Kernel Bayes' rule

In probability theory, a posterior distribution can be expressed in terms of a prior distribution and a likelihood function as
The analog of this rule in the kernel embedding framework expresses the kernel embedding of the conditional distribution in terms of conditional embedding operators which are modified by the prior distribution
where from the chain rule:
In practical implementations, the [|kernel Bayes' rule] takes the following form
where
Two regularization parameters are used in this framework: for the estimation of and for the estimation of the final conditional embedding operator
The latter regularization is done on square of because may not be positive definite.

Applications

Measuring distance between distributions

The maximum mean discrepancy is a distance-measure between distributions and which is defined as the squared distance between their embeddings in the RKHS
While most distance-measures between distributions such as the widely used Kullback–Leibler divergence either require density estimation or space partitioning/bias correction strategies, the MMD is easily estimated as an empirical mean which is concentrated around the true value of the MMD. The characterization of this distance as the maximum mean discrepancy refers to the fact that computing the MMD is equivalent to finding the RKHS function that maximizes the difference in expectations between the two probability distributions

Kernel two-sample test

Given n training examples from and m samples from, one can formulate a test statistic based on the empirical estimate of the MMD
to obtain a two-sample test of the null hypothesis that both samples stem from the same distribution against the broad alternative.

Density estimation via kernel embeddings

Although learning algorithms in the kernel embedding framework circumvent the need for intermediate density estimation, one may nonetheless use the empirical embedding to perform density estimation based on n samples drawn from an underlying distribution. This can be done by solving the following optimization problem
where the maximization is done over the entire space of distributions on Here, is the kernel embedding of the proposed density and is an entropy-like quantity. The distribution which solves this optimization may be interpreted as a compromise between fitting the empirical kernel means of the samples well, while still allocating a substantial portion of the probability mass to all regions of the probability space. In practice, a good approximate solution of the difficult optimization may be found by restricting the space of candidate densities to a mixture of M candidate distributions with regularized mixing proportions. Connections between the ideas underlying Gaussian processes and conditional random fields may be drawn with the estimation of conditional probability distributions in this fashion, if one views the feature mappings associated with the kernel as sufficient statistics in generalized exponential families.

Measuring dependence of random variables

A measure of the statistical dependence between random variables and can be formulated based on the Hilbert–Schmidt Independence Criterion
and can be used as a principled replacement for mutual information, Pearson correlation or any other dependence measure used in learning algorithms. Most notably, HSIC can detect arbitrary dependencies, and can be used to measure dependence between different types of data. Given n i.i.d. samples of each random variable, a simple parameter-free unbiased estimator of HSIC which exhibits concentration about the true value can be computed in time, where the Gram matrices of the two datasets are approximated using with. The desirable properties of HSIC have led to the formulation of numerous algorithms which utilize this dependence measure for a variety of common machine learning tasks such as: feature selection, clustering, and dimensionality reduction.
HSIC can be extended to measure the dependence of multiple random variables. The question of when HSIC captures independence in this case has recently been studied: for
more than two variables
is a fundamental algorithm for inference in graphical models in which nodes repeatedly pass and receive messages corresponding to the evaluation of conditional expectations. In the kernel embedding framework, the messages may be represented as RKHS functions and the conditional distribution embeddings can be applied to efficiently compute message updates. Given n samples of random variables represented by nodes in a Markov random field, the incoming message to node t from node u can be expressed as
if it assumed to lie in the RKHS. The kernel belief propagation update message from t to node s is then given by
where denotes the element-wise vector product, is the set of nodes connected to t excluding node s,, are the Gram matrices of the samples from variables, respectively, and is the feature matrix for the samples from.
Thus, if the incoming messages to node t are linear combinations of feature mapped samples from, then the outgoing message from this node is also a linear combination of feature mapped samples from. This RKHS function representation of message-passing updates therefore produces an efficient belief propagation algorithm in which the potentials are nonparametric functions inferred from the data so that arbitrary statistical relationships may be modeled.

Nonparametric filtering in hidden Markov models

In the hidden Markov model, two key quantities of interest are the transition probabilities between hidden states and the emission probabilities for observations. Using the kernel conditional distribution embedding framework, these quantities may be expressed in terms of samples from the HMM. A serious limitation of the embedding methods in this domain is the need for training samples containing hidden states, as otherwise inference with arbitrary distributions in the HMM is not possible.
One common use of HMMs is filtering in which the goal is to estimate posterior distribution over the hidden state at time step t given a history of previous observations from the system. In filtering, a belief state is recursively maintained via a prediction step followed by a conditioning step. The RKHS embedding of the belief state at time t+1 can be recursively expressed as
by computing the embeddings of the prediction step via the kernel sum rule and the embedding of the conditioning step via kernel Bayes' rule. Assuming a training sample is given, one can in practice estimate
and filtering with kernel embeddings is thus implemented recursively using the following updates for the weights
where denote the Gram matrices of and respectively, is a transfer Gram matrix defined as and

Support measure machines

The support measure machine is a generalization of the support vector machine in which the training examples are probability distributions paired with labels. SMMs solve the standard SVM dual optimization problem using the following expected kernel
which is computable in closed form for many common specific distributions combined with popular embedding kernels , or can be accurately empirically estimated from i.i.d. samples via
Under certain choices of the embedding kernel, the SMM applied to training examples is equivalent to a SVM trained on samples, and thus the SMM can be viewed as a flexible SVM in which a different data-dependent kernel may be placed on each training point.

Domain adaptation under covariate, target, and conditional shift

The goal of domain adaptation is the formulation of learning algorithms which generalize well when the training and test data have different distributions. Given training examples and a test set where the are unknown, three types of differences are commonly assumed between the distribution of the training examples and the test distribution :
  1. Covariate shift in which the marginal distribution of the covariates changes across domains:
  2. Target shift in which the marginal distribution of the outputs changes across domains:
  3. Conditional shift in which remains the same across domains, but the conditional distributions differ:. In general, the presence of conditional shift leads to an ill-posed problem, and the additional assumption that changes only under location-scale transformations on is commonly imposed to make the problem tractable.
By utilizing the kernel embedding of marginal and conditional distributions, practical approaches to deal with the presence of these types of differences between training and test domains can be formulated. Covariate shift may be accounted for by reweighting examples via estimates of the ratio obtained directly from the kernel embeddings of the marginal distributions of in each domain without any need for explicit estimation of the distributions. Target shift, which cannot be similarly dealt with since no samples from are available in the test domain, is accounted for by weighting training examples using the vector which solves the following optimization problem
To deal with location scale conditional shift, one can perform a LS transformation of the training points to obtain new transformed training data . To ensure similar distributions between the new transformed training samples and the test data, are estimated by minimizing the following empirical kernel embedding distance
In general, the kernel embedding methods for dealing with LS conditional shift and target shift may be combined to find a reweighted transformation of the training data which mimics the test distribution, and these methods may perform well even in the presence of conditional shifts other than location-scale changes.

Domain generalization via invariant feature representation

Given N sets of training examples sampled i.i.d. from distributions, the goal of domain generalization is to formulate learning algorithms which perform well on test examples sampled from a previously unseen domain where no data from the test domain is available at training time. If conditional distributions are assumed to be relatively similar across all domains, then a learner capable of domain generalization must estimate a functional relationship between the variables which is robust to changes in the marginals. Based on kernel embeddings of these distributions, Domain Invariant Component Analysis is a method which determines the transformation of the training data that minimizes the difference between marginal distributions while preserving a common conditional distribution shared between all training domains. DICA thus extracts invariants, features that transfer across domains, and may be viewed as a generalization of many popular dimension-reduction methods such as kernel principal component analysis, transfer component analysis, and covariance operator inverse regression.
Defining a probability distribution on the RKHS with
DICA measures dissimilarity between domains via distributional variance which is computed as
where
so is a Gram matrix over the distributions from which the training data are sampled. Finding an orthogonal transform onto a low-dimensional subspace B which minimizes the distributional variance, DICA simultaneously ensures that B aligns with the bases of a central subspace C for which becomes independent of given across all domains. In the absence of target values, an unsupervised version of DICA may be formulated which finds a low-dimensional subspace that minimizes distributional variance while simultaneously maximizing the variance of across all domains.

Distribution regression

In distribution regression, the goal is to regress from probability distributions to reals. Many important machine learning and statistical tasks fit into this framework, including multi-instance learning, and point estimation problems without analytical solution. In practice only samples from sampled distributions are observable, and the estimates have to rely on similarities computed between sets of points. Distribution regression has been successfully applied for example in supervised entropy learning, and aerosol prediction using multispectral satellite images.
Given training data, where the bag contains samples from a probability distribution and the output label is, one can tackle the distribution regression task by taking the embeddings of the distributions, and learning the regressor from the embeddings to the outputs. In other words, one can consider the following kernel ridge regression problem
where
with a kernel on the domain of -s, is a kernel on the embedded distributions, and is the RKHS determined by. Examples for include the linear kernel, the Gaussian kernel, the exponential kernel, the Cauchy kernel, the generalized t-student kernel, or the inverse multiquadrics kernel.
The prediction on a new distribution takes the simple, analytical form
where,,,. Under mild regularity conditions this estimator can be shown to be consistent and it can achieve the one-stage sampled minimax optimal rate. In the objective function -s are real numbers; the results can also be extended to the case when -s are -dimensional vectors, or more generally elements of a separable Hilbert space using operator-valued kernels.

Example

In this simple example, which is taken from Song et al., are assumed to be discrete random variables which take values in the set and the kernel is chosen to be the Kronecker delta function, so. The feature map corresponding to this kernel is the standard basis vector. The kernel embeddings of such a distributions are thus vectors of marginal probabilities while the embeddings of joint distributions in this setting are matrices specifying joint probability tables, and the explicit form of these embeddings is
The conditional distribution embedding operator,
is in this setting a conditional probability table
and
Thus, the embeddings of the conditional distribution under a fixed value of may be computed as
In this discrete-valued setting with the Kronecker delta kernel, the kernel sum rule becomes
The kernel chain rule in this case is given by