Tutorials › Multivariate Statistics (Graduate) › Characteristic Kernels and HSIC Consistency

Multivariate Dependence Testing · Tutorial 442 of 975

Characteristic Kernels and HSIC Consistency

See how characteristic kernels make population HSIC a precise measure of dependence and establish its separation of every fixed alternative to independence.

Advanced 12 min read

What You'll Learn

  • Define characteristic kernels through injectivity of probability-measure embeddings.
  • Relate population HSIC to the joint-versus-product embedding difference.
  • Prove that characteristic kernels on both margins make HSIC zero exactly under independence.
  • Verify characteristicness for Gaussian kernels using characteristic functions.
  • Work through dependent and independent binary examples.
  • Explain how population separation supports consistency against fixed alternatives.

Why Characteristic Kernels Matter

A dependence measure is useful as a test statistic only if it can distinguish dependence from independence in the population. A covariance-based measure can miss nonlinear relationships, so a natural question is whether a kernel-based measure can detect every departure from independence. The answer depends on the kernels: their feature representations must preserve enough information about the distributions being compared.

For a random variable \(X\), a kernel maps each possible value \(x\) to a feature vector in a reproducing kernel Hilbert space (RKHS). Averaging these vectors gives a representation of the distribution of \(X\). A kernel is characteristic when no two different probability distributions have the same average feature vector. This property connects the distribution-level question of independence to the operator defining population HSIC.

Definition: Let \(k\) be a measurable positive definite kernel on a measurable space \(\mathcal X\), with RKHS \(\mathcal H_k\) and feature map \(\phi(x)=k(x,\cdot)\). If \(k\) is bounded, every probability measure \(P\) on \(\mathcal X\) has a mean embedding \(\mu_P=E_{X\sim P}[\phi(X)]\). The kernel \(k\) is characteristic if the map \(P\mapsto\mu_P\) is injective on probability measures: \(\mu_P=\mu_Q\) implies \(P=Q\).

Throughout, take \(\mathcal X\) and \(\mathcal Y\) to be standard Borel spaces, and let \(k\) and \(l\) be bounded measurable positive definite kernels on them, with separable RKHSs \(\mathcal H_k\) and \(\mathcal H_l\). These conditions ensure that the feature means and cross-covariance operator below are well-defined. Boundedness also ensures that every RKHS function is bounded: if \(k(x,x)\leq K\), then \(|f(x)|\leq \|f\|_{\mathcal H_k}\sqrt K\).

Population HSIC as a Distributional Difference

Write \(\phi(x)=k(x,\cdot)\), \(\psi(y)=l(y,\cdot)\), \(\mu_X=E[\phi(X)]\), and \(\mu_Y=E[\psi(Y)]\). The cross-covariance operator \(C_{XY}:\mathcal H_l\to\mathcal H_k\) is defined by \(C_{XY}g=E[(\phi(X)-\mu_X)\langle\psi(Y)-\mu_Y,g\rangle_{\mathcal H_l}]\). Population HSIC is the squared Hilbert–Schmidt norm of this operator.

Definition: The population Hilbert–Schmidt independence criterion is \(\operatorname{HSIC}(P_{XY};k,l)=\|C_{XY}\|_{\mathrm{HS}}^2\). It is nonnegative, and it is zero exactly when the cross-covariance operator is zero.

There is a useful equivalent description. The product kernel on \(\mathcal X\times\mathcal Y\) is \(q((x,y),(x',y'))=k(x,x')l(y,y')\), with feature map \(\phi(x)\otimes\psi(y)\). Its mean embedding under the joint distribution is \(E[\phi(X)\otimes\psi(Y)]\). Under the product of the marginal distributions, the embedding is \(\mu_X\otimes\mu_Y\). Their difference is precisely \(C_{XY}\), viewed as a Hilbert–Schmidt operator or its corresponding tensor.

$$ \operatorname{HSIC}(P_{XY};k,l) = \left\|E[\phi(X)\otimes\psi(Y)]-\mu_X\otimes\mu_Y\right\|^2 = \operatorname{MMD}_{q}^{\,2}(P_{XY},P_X\otimes P_Y). $$

Here \(\operatorname{MMD}_{q}\) is the maximum difference in expectations over functions in the unit ball of the RKHS of \(q\); equivalently, its square is the squared distance between the two \(q\)-mean embeddings. This identity explains why HSIC compares the joint distribution with the distribution that would result from making the margins independent. The next result gives the precise zero criterion needed for that comparison.

Theorem: Under the conditions above, if both \(k\) and \(l\) are characteristic, then \(\operatorname{HSIC}(P_{XY};k,l)=0\) if and only if \(X\) and \(Y\) are independent.

Proof. If \(X\) and \(Y\) are independent, then for any \(f\in\mathcal H_k\) and \(g\in\mathcal H_l\), \(E[(f(X)-E f(X))(g(Y)-E g(Y))]=0\). Thus \(C_{XY}=0\), and HSIC is zero.

For the converse, suppose HSIC is zero. Then \(C_{XY}=0\), so the same covariance is zero for every \(f\in\mathcal H_k\) and \(g\in\mathcal H_l\). Fix \(f\in\mathcal H_k\), and let \(r_f(y)=E[f(X)\mid Y=y]-E[f(X)]\), using a regular conditional distribution, which exists on standard Borel spaces. This function is integrable and has mean zero. Conditional expectation gives, for every \(g\in\mathcal H_l\),

$$ \int g(y)r_f(y)\,dP_Y(y) = E[(f(X)-E f(X))(g(Y)-E g(Y))] = 0. $$

Define the finite signed measure \(\nu_f\) by \(d\nu_f(y)=r_f(y)dP_Y(y)\). It has total mass zero, and the displayed equality says that its kernel mean embedding is zero: \(\int\psi(y)d\nu_f(y)=0\). Characteristicness of \(l\) implies that a finite signed measure of total mass zero with zero embedding must itself be zero. To see this, write its Jordan decomposition as \(\nu_f=\nu_f^+-\nu_f^-\). The two positive measures have equal mass; if that mass is positive, normalizing them gives probability measures with equal embeddings, so characteristicness makes them equal. If the mass is zero, both are zero. Hence \(r_f=0\) \(P_Y\)-almost surely.

It follows that for each \(f\in\mathcal H_k\), the conditional expectation \(E[f(X)\mid Y]\) equals \(E[f(X)]\) almost surely. Because \(\mathcal H_k\) is separable, choose a countable dense subset and intersect the corresponding probability-one events. On the resulting single probability-one set of \(y\)'s, the equality holds for every function in that subset. It extends to every \(f\in\mathcal H_k\): convergence in RKHS norm implies uniform convergence because \(k\) is bounded. Thus, for almost every \(y\), the conditional distribution \(P_{X\mid Y=y}\) and the marginal \(P_X\) have equal \(k\)-mean embeddings. Characteristicness of \(k\) gives \(P_{X\mid Y=y}=P_X\) for almost every \(y\). This is exactly independence of \(X\) and \(Y\). \(\square\)

Worked Examples

Worked Example: Gaussian Kernels Are Characteristic

On \(\mathbb R^d\), consider the Gaussian kernel \(k_\sigma(x,x')=\exp(-\|x-x'\|^2/(2\sigma^2))\), where \(\sigma>0\). Show that it is characteristic.

Let \(P\) and \(Q\) be probability distributions, and let \(\varphi_P(\omega)=E_{X\sim P}[e^{i\omega^\mathsf{T}X}]\) and \(\varphi_Q\) be their characteristic functions. The Gaussian Fourier representation is \(k_\sigma(x,x')=\int e^{i\omega^\mathsf{T}(x-x')}\rho_\sigma(\omega)d\omega\), where \(\rho_\sigma(\omega)=(\sigma/\sqrt{2\pi})^d\exp(-\sigma^2\|\omega\|^2/2)\). This is a probability density that is strictly positive for every \(\omega\).

Taking expectations under independent draws from \(P\) and \(Q\), and expanding the squared embedding distance, gives

$$ \|\mu_P-\mu_Q\|_{\mathcal H_k}^2 = \int_{\mathbb R^d} |\varphi_P(\omega)-\varphi_Q(\omega)|^2 \rho_\sigma(\omega)\,d\omega. $$

The integrand is nonnegative. If the embedding distance is zero, the integral is zero; since \(\rho_\sigma\) is strictly positive, the characteristic functions agree almost everywhere. Characteristic functions are continuous, so they agree everywhere: if their difference were nonzero at one point, continuity would make it nonzero on a neighborhood of positive Lebesgue measure. By uniqueness of characteristic functions, \(P=Q\). Thus the Gaussian kernel is characteristic.

Worked Example: A Dependent Binary Pair Has Positive HSIC

Let \(X\) take values 0 and 1 with probability \(1/2\) each, and let \(Y=X\). Use the Gaussian kernel with \(\sigma=1\) on both margins. Compute a nonzero cross-covariance that guarantees positive HSIC.

For either margin, define \(f(x)=k_1(x,1)-k_1(x,0)\). Since \(k_1(0,1)=e^{-1/2}\) and \(k_1(0,0)=k_1(1,1)=1\), write \(a=1-e^{-1/2}\); then \(f(0)=-a\) and \(f(1)=a\). The same function is used for \(Y\). Both expectations are zero because the two values are equally likely. Since \(Y=X\),

$$ \operatorname{Cov}(f(X),f(Y)) = E[f(X)f(Y)] = \frac12a^2+\frac12a^2 = a^2 = (1-e^{-1/2})^2 \approx 0.1548. $$

The feature function \(f\) is an RKHS function on each margin. If the cross-covariance operator were zero, every such pair of functions would have covariance zero. The positive value therefore implies \(C_{XY}\ne0\), and consequently \(\operatorname{HSIC}>0\). The Gaussian kernels are characteristic, so the theorem also guarantees this result without requiring this particular calculation.

Worked Example: Independent Binary Margins Give Zero HSIC

Let \(X\) and \(Y\) be independent, each taking 0 and 1 with probability \(1/2\), again with Gaussian kernels of bandwidth 1. Verify directly that their population cross-covariance operator is zero.

For any \(f\in\mathcal H_k\) and \(g\in\mathcal H_l\), independence gives \(E[f(X)g(Y)]=E[f(X)]E[g(Y)]\). Therefore

$$ E[(f(X)-E f(X))(g(Y)-E g(Y))] = E[f(X)g(Y)]-E[f(X)]E[g(Y)] = 0. $$

Every matrix coefficient of \(C_{XY}\) is therefore zero, so \(C_{XY}=0\) and \(\operatorname{HSIC}=0\). In feature notation the same calculation factors as \(E[(\phi(X)-\mu_X)\otimes(\psi(Y)-\mu_Y)] =E[\phi(X)-\mu_X]\otimes E[\psi(Y)-\mu_Y]=0\). The theorem confirms that this zero is not a failure to detect some hidden dependence: the specified variables really are independent.

What the Result Does—and Does Not—Guarantee

Characteristicness is a population identification property. It says that distinct distributions cannot collapse to the same mean embedding. The theorem applies this property twice: characteristicness of \(l\) turns zero cross-covariance into constant conditional expectations for all functions of \(X\); characteristicness of \(k\) then turns those equalities into equality of conditional and marginal distributions. Both margins matter in this argument.

Population separation is the key ingredient behind consistency against fixed alternatives. In particular, suppose a sequence of nonnegative statistics \(T_n\) estimates population HSIC and satisfies \(T_n\xrightarrow{p}h\), where \(h=\operatorname{HSIC}(P_{XY};k,l)>0\). If its rejection threshold \(c_n\) tends to zero, then

$$ P(T_n>c_n) \geq P(T_n>h/2) \longrightarrow 1 $$

for all sufficiently large \(n\), since then \(c_n<h/2\). Thus population separation, together with suitable estimation and calibration, yields power tending to one for each fixed dependent distribution. This argument alone does not establish a particular estimator's convergence or a valid null threshold; those require separate analysis.

A common mistake is to assume that a characteristic kernel on just one margin is enough. For example, if \(X=Y\) is the dependent binary pair above but the kernel on \(Y\) is the constant kernel \(l(y,y')=1\), then every centered feature \(\psi(Y)-\mu_Y\) is zero. HSIC is therefore zero regardless of the dependence, even though the kernel on \(X\) is characteristic. The constant kernel cannot distinguish probability distributions on a nontrivial space. The theorem's guarantee requires characteristic kernels on both margins.

Key takeaway: With bounded measurable kernels and the stated regularity conditions, characteristic kernels on both margins make population HSIC zero exactly under independence. This is a guarantee about population identification; consistency of a specific test also requires an estimator and calibration with appropriate convergence properties.

Check Your Understanding

Use the definitions and result above to answer the following questions.

  1. What does it mean for a kernel to be characteristic, and which objects must it distinguish?
  2. Why does independence imply that the population cross-covariance operator is zero?
  3. In the converse proof, why does characteristicness of \(l\) imply that \(r_f(y)P_Y(dy)\) is the zero signed measure?
  4. Why are characteristic kernels required on both margins in the zero-HSIC theorem?
  5. If \(T_n\xrightarrow{p}h>0\) and \(c_n\to0\), why does \(P(T_n>c_n)\to1\)?
Clinical Biostats