Symmetric positive semi-definite (PSD) matrices come up in a variety of places in machine learning, statistics, and optimization, and more generally in most domains of applied mathematics. When estimating or optimizing over the set of such matrices, several geometries can be used. The most direct one is to consider PSD matrices as a convex set in the vector space of all symmetric matrices and thus to inherit the Euclidean geometry. Like for the positive orthant (which corresponds to diagonal PSD matrices), this is not natural for a variety of reasons. In this post we will consider Bregman divergences to define our notion of geometry.
A first natural and common geometry is to consider PSD matrices as covariance matrices (or their inverses, often referred to a precision or concentration matrices). They can thus be seen as parameters of zero-mean Gaussian random vectors, and classical notions from information theory, such as the Kullback-Leibler divergence, can be brought to bear to define a specific geometry. This happens to be equivalent to using the negative log determinant to define the Bregman divergence, and leads to the usual Stein divergence
which is the Kullback Leibler divergence between two Gaussian random vectors with zero means and covariance matrices B and A.
In this blog post, we consider a different but related matrix function, which will be A↦tr[AlogA] instead of –tr[logA]. This will have stronger links with the Shannon entropy of discrete random variables [1]. In particular, we will be able to extend two classical notions related to discrete entropy:
The entropy function H(p)=–∑i=1dpilogpi, defined on the simplex Δ⊂Rd (vectors with non-negative components that sum to one), is concave, while the associated Bregman divergence, here the usual Kullback-Leibler (KL) divergence, is
i=1∑dpilogqipi.
It is jointly convex in the vectors p and q (see this nice article [6] for other jointly convex Bregman divergences). Note that the joint convexity is here a direct application of classical results regarding the convexity of the perspective of a convex function [10, section 3.2.6].
The Fenchel-Legendre conjugate of −H (with the simplex as domain) is
p∈Δsupp⊤z–i=1∑dpilogpi=log(i=1∑dexp(zi)).
With the positive orthant as the domain, we have
p∈R+dsupp⊤z–i=1∑dpilogpi=i=1∑dexp(zi−1).
This has many consequences in probabilistic modelling, notably the duality between maximum likelihood and maximum entropy [1, 7].
The extension to matrices will have several interesting consequences:
This defines a Bregman divergence that has interesting applications to mirror descent and smoothing techniques in optimization.
The non-trivial joint convexity of the associated Bregman divergence will lead to elegant methods for deriving concentration inequalities for symmetric matrices [2].
Application to covariance operators in infinite-dimensional spaces will lead to a whole range of information-theoretic results [5], but this is for next month!
Von Neumann entropy and relative entropy
Given a positive semi-definite symmetric matrix A∈Sd, the von Neumann entropy is defined as
H(A)=–tr[AlogA],
as the trace of the matrix function –AlogA, or equivalently as –∑i=1dλilogλi where λ1,…,λd⩾0 are the d eigenvalues of A (note that we can have a zero eigenvalue and still be finite).
From last month blog post, we get that H is concave. We can then naturally define on the spectrahedron (set of positive semi-definite matrices with unit trace), the relative entropy, which is the Bregman divergence associated with the function A↦tr[AlogA], whose gradient is logA+I, leading to:
D(A∥B)=tr[AlogA]–tr[BlogB]–tr[(A–B)(logB+I)],
which is equal to
D(A∥B)=tr[A(logA–logB)]–tr(A)+tr(B).
This time we have to be careful to avoid infinite values: it is finite if and only if the null space of B is included in the one of A, or, equivalently if B−1/2A1/2B−1/2 is finite. Note that when A and B have unit traces, the term in –tr(A)+tr(B) goes away.
As a Bregman divergence of a strictly convex function, D(A∥B) is non-negative and equal to zero if and only if A=B.
When A=Diag(p) and B=Diag(q) are diagonal, we get
D(A∥B)=i=1∑d{pilogqipi–pi+qi},
and we recover the traditional relative entropy.
Please refrain from writing D(A∥B)=tr[Alog(AB−1)]–tr(A)+tr(B), which is not true unless A and B commute. See however below how using Kronecker products can make a similar equality always true.
A geometry on matrices
The von Neumann relative entropy (also referred to as matrix KL divergence) defines a new notion of geometry, which is different from the Euclidean geometry based on the squared Frobenius norm ∥A–B∥F2=tr[(A−B)2]. Below, we plot and compare balls for these various geometries. We first consider Euclidean balls, defined as
\mboxEuclidean:{B∈Sd,∥A–B∥F2⩽r},
as well as the two KL balls (one for each side of the KL divergence):
\mboxLeftKL:{B∈Sd,D(B∥A)⩽r},
\mboxRightKL:{B∈Sd,D(A∥B)⩽r}.
Diagonal matrices with unit trace (isomorphic to the simplex). We consider diagonal matrices A=Diag(p) with p in the simplex. We compare the three balls below (in yellow), with r=1/16 for the three of them.
While the Euclidean balls have the same shapes at all positions, the KL balls adapt their shapes to their centers.
Unit trace PSD matrices in dimension two (isomorphic to the Euclidean ball). We consider matrices A=(xyy1−x) with the PSD constraint being equivalent to y2⩽x(1−x), that is, (x,y) is in the disk of center (21,0) and radius 21. We compare the three balls below (in yellow), with r=321 for the Euclidean ball, and r=161 for the KL balls, with a similar difference between geometries.
Pinsker inequality
In order to use the relative entropy within mirror descent, we need an extension of the Pinsker inequality
i=1∑dpilogqipi⩾21(i=1∑d∣pi–qi∣)2,
which is, in optimization terms, the 1-strong-concavity of the entropy with respect to the ℓ1-norm. It turns out that the natural extension is true, that is, for PSD matrices with unit trace,
D(A∥B)=tr[A(logA–logB)]⩾21∥A–B∥∗2,
where ∥⋅∥∗ denotes the trace norm, a.k.a. the nuclear norm, that is, the ℓ1-norm of eigenvalues. See [3] for a nice and simple proof.
This allows to use the relative entropy when optimizing over the spectrahedron using mirror descent [11]. Note that the diameter supAtr[AlogA]–infAtr[AlogA] over PSD matrices with unit trace is equal to logd. Using duality, the relative entropy can also be used for smoothing the maximal eigenvalue of a matrix [12].
Joint convexity of matrix relative entropy
While the convexity with respect to A is straightforward, the relative entropy D(A∥B) is also jointly convex in (A,B), which is crucial in the developments below. There exist several proofs, but one is particularly elegant [4] and will use the matrix-monotonicity that I presented in the last post.
Kronecker products. We need to make a clever use of Kronecker products. Given two matrices A and B of any sizes, A⊗B is the matrix defined by blocks AijB, thus of size the products of the number of rows and columns of A and B. In the derivations below, both A and B will be of size d×d, and thus A⊗B is then of size d2×d2.
Kronecker products have very nice properties (they would probably deserve their own post!), such as (when dimensions are compatible), (A⊗B)(C⊗D)=(AC)⊗(BD) or (A⊗B)−1=A−1⊗B−1. What we will leverage is their use in characterizing linear operations on matrices. For a rectangular matrix X∈Rd1×d2, vec(X)∈Rd1d2×1 denotes the vectorization of X obtained by stacking all columns of X one after the other in a single column vector. Then, we have
(B⊤⊗A)vec(X)=vec(AXB)
for any A,X,B with compatible dimensions.
Reformulation of relative entropy. We can now use Kronecker products to get:
The key element is then to use the identity for PSD matrices
log(C⊗D)=logC⊗I+I⊗logD
(which can be shown using the fact that eigenvalue decomposition of a Kronecker product of symmetric matrices can be obtained from the decompositions of the factors), leading to
We can then use the joint convexity of the function (C,D)↦tr[C⊤D−1C] to get the joint convexity of D(A∥B).
This extends to all matrix-convex functions beyond the logarithm, such as λ↦(λ−1)2, λ↦1–λ1/2 or λ↦λ1(λ−1)2, leading to other f-divergences between matrices. See [5, Appendix A.4] for details.
Lieb concavity theorems
Now that (A,B)↦D(A∥B) is jointly convex on all PSD matrices (not only unit trace), for any fixed symmetric matrix M, the function
φ:B↦A≽0suptr(AM)+tr(A)–D(A∥B),
as the partial maximization (with respect to B) of a jointly concave function of (A,B), is concave. We can maximize in closed form with respect to A by computing the gradient M–logA+logB, leading to A=exp(M+logB), and
φ(B)=trexp(M+logB),
which defines a concave function. This is one version of the classical Lieb concavity theorems [8].
As a consequence, we can obtain the “subadditivity of the matrix cumulant generative function”. That is, for any random independent symmetric matrices X1,…,Xn of the same sizes,
E[trexp(i=1∑nXi)]⩽trexp(i=1∑nlog(E[exp(Xi)]),
which can be shown by recursion using Jensen’s inequality for the function φ above with a well-chosen matrix M. See [2] for details.
We are now ready to consider concentration inequalities for random matrices.
Application to concentration inequalities
We consider random independent random matrices X1,…,Xn such that E[Xi]=0 for all i∈{1,…,n}. Let S=n1∑i=1nXi (which has zero mean). Our goal is to provide upper bounds on E[λmax(S)] and P[λmax(S)⩾t]. We follow the outstanding work and presentation of Joel Tropp [2]: using the proper matrix tools presented above, we can get for matrix-valued random variables the almost exact same proofs of the usual concentration inequalities for real-valued random variables, such as Hoeffding, Bernstein, Azuma, or Mac-Diarmid inequalities.
Expectation. We have, for any u>0, by homogeneity of the largest eigenvalue:
We can then use Jensen’s inequality for the logarithm to get (together with the fact the largest eigenvalue of the exponential is the exponential of the largest eigenvalue):
and finally that for a PSD matrix the trace is larger than the largest eigenvalue, to get
E[λmax(S)]⩽u1logE[trexp(uS)].
Experts in concentration inequalities have probably recognized the usual argument to bound the expectation of the maximum of d random real-valued (non necessarily independent) variables X1,…,Xd, as
E[max{Y1,…,Yd}]⩽u1logE[exp(uY1)+⋯+exp(uYd)].
Tail bound. We have, using Markov’s inequality, for any u>0:
We can now consider random matrices such that aI≼Xi≼bI almost surely for all i=1,…,n (and still with zero mean). We first need a lemma whose proof is given at the end of the post, with the exact same proof as for the uni-dimensional case.
Lemma. If E[X]=0 and aI≼X≼bI almost surely, then for all u>0,
E[exp(uX)]≼exp(8u2(b−a)2)I.
Together with the consequence of Lieb’s result presented above and the matrix-monotonicity of the logarithm, we get:
We can then get immediately, by optimizing with respect to u (with optimal value u=4nt/(b−a)2),
P[λmax(S)⩾t]⩽dexp(–(b−a)22nt2),
and, with optimal value u=22nlogd/(b−a):
E[λmax(S)]⩽2nb−alogd.
Note that these are the exact same results as when d=1!
Extensions. As nicely detailed in [2], there are extensions to all classical concentration inequalities. Moreover, this can be applied to rectangular matrices, where the largest eigenvalue is replaced by the largest singular value. Finally, for those who like to work in infinite dimensions and cannot bear the explicit dependence in dimension, it is possible to derive results that depend only on a well-defined notion of “intrinsic dimension” (the associated results can then be used for the study of kernel methods, see [13, chapter 9]).
Conclusion
Now that we know everything about the matrix relative entropy and its convexity properties, we will explore next month a new link between eigenvalues of covariance operators and the regular Shannon entropy of the generating probability distribution [5], thus mixing my favorite recent mathematical topic with my probably all-time favorite one: positive definite kernels!
Proof of lemma on matrix cumulant generating functions
Lemma. If E[X]=0 and aI≼X≼bI almost surely, then for all u>0,
E[exp(uX)]≼exp(8u2(b−a)2I)=exp(8u2(b−a)2)I.
Note that we have a⩽0⩽b.
Proof. We follow the standard proof [9] for real-valued random variables, simply transferred to the matrix case. On the interval [a,b], by convexity of the exponential function
exp(uλ)⩽exp(ub)b−aλ−a+exp(ua)b−ab–λ.
Thus (check why we can do this), almost surely:
exp(uX)≼exp(ub)b−aX−aI+exp(ua)b−abI–X,
leading to E[exp(uX)]≼b−abexp(ua)–aexp(ub)I. We can then show that b−abexp(ua)–aexp(ub)⩽exp(8u2(b−a)2) to conclude the proof. We thus need to show that ψ(u)=log(b−abexp(ua)–aexp(ub))⩽8u2(b−a)2 for all u⩾0. We can simply express ψ(u) as a rescaled logistic function as
ψ(u)=ua+logb−ab+log[1+exp(u(b−a)+logb−a−a)].
We have ψ(0)=0, and
ψ′(u)=bexp(ua)–aexp(ub)baexp(ua)–abexp(ub),
thus ψ′(0)=0, and through the link with the logistic function, the second-order derivarive is less than (b−a)2/4. This leads to the desired result by Taylor’s formula.