Following up my last post on Chebyshev polynomials, another piece of polynomial magic this month. This time, Jacobi polynomials will be the main players.
Since definitions and various formulas are not as intuitive as for Chebyshev polynomials, I will start by the machine learning / numerical analysis motivation, which is an elegant refinement of Chebyshev acceleration.
Spectral measures and polynomial acceleration
Like in the previous post, we consider the iteration in Rn
xk+1=Axk–b,
with A∈Rn×n a symmetric matrix with spectrum Spec(A)⊂(−1,1), with unique fixed point x∗ such that x∗=Ax∗–b, that is, x∗=(A–I)−1b. These recursions naturally come up in gradient descent for quadratic functions or gossip algorithms (as described later).
In order to speed-up convergence, a classical idea explored in the last post is to take linear combinations of all past iterates. That is, we consider yk=∑i=0kνikxi for some weights νik such that ∑i=0kνik=1 (so that if all iterates are already at x∗, then the weighted average stays there). We have
Using the fact that Spec(A)⊂[−1+δ,1−δ] for some δ>0, minimizing maxλ∈Spec(A)∣Pk(λ)∣2 subject to Pk(1)=1 led to a rescaled Chebyshev polynomials. This allowed to go from a convergence rate proportional to (1−δ)k to a convergence rate proportional to (1–2δ)k.
When δ is small, this is a significant gain. But when δ is really small, none of the two techniques converge quickly enough, in particular in early iterations where the exponential convergence regime has not been reached. However, only a few eigenvalues are close to −1 or 1 (see examples in gossip matrices below), and using more information about eigenvalues beyond the smallest and largest ones can be advantageous.
Histogram of eigenvalues of gossip matrices for gossiping within the 1D, 2D and 3D grid, with the same number of nodes n=4096: the eigengap 1−ρ is small, and the eigenvalues are well-spread. See more details in the gossip section below.
We will use the spectral decomposition A=∑i=1nλiuiui⊤, where λi is an eigenvalue of A with orthonormal eigenvectors ui, i=1,…,n. We thus have
Assuming [(x0–x∗)⊤ui]2≤τ2 for all i=1,…,n (that is, the initial deviation from the optimum has uniform magnitude on all eigenvectors), we need to minimize
e(Pk)=n1i=1∑nPk(λi)2=∫−11Pk(λ)2dσ(λ)
with respect to Pk, where dσ=n1∑i=1nδλi is the spectral probability measure of A.
Now, the new goal is to minimize ∫−11Pk(λ)2dσ(λ) with respect to a polynomial Pk with degree k and such that Pk(1)=1. This is where orthogonal polynomials naturally come in. Their use in creating acceleration mechanisms dates back from numerical analysis in the 1980’s and 1990’s (with a very nice and detailed account in [1]).
Orthogonal polynomials and kernel polynomials
We consider a sequence of orthogonal polynomialsQk for the probability measure dσ in support within [−1,1], each of degree k, which we do not assume normalized. They are essentially unique (up to rescaling); see, e.g., the very good books by Gábor Szegő [2] and Theodore Seio Chihara [3].
We denote by αi=∫−11Qi2(λ)dσ(λ), for i≥0, the squared norm of Qi, so that the sequence of polynomials (αi−1/2Qi) is orthonormal. We can then solve the optimization problem above for Pk, by writing it Pk(X)=∑i=0kuiαi−1/2Qi(X), and the problem in u∈Rk+1 becomes:
This optimization problem can be solved in closed form, and the solution is such that ui=∑j=0kαj−1Qj(1)2αi−1/2Qi(1) for all i, with the optimal polynomial
The polynomials ∑i=0kαi−1Qi(X)Qi(Y) are called the kernel polynomials [3, Chapter I, Section 7] associated to dσ, and have many properties (beyond the optimality property which we just proved) that we will use below.
At this point, the problem seems essentially solved: one can construct iteratively the polynomials Qk using classical second-order recursions for orthogonal polynomials, and thus compute Pk(X) which is proportional to ∑i=0kαi1Qi(1)Qi(X). This leads however to a somewhat complicated algorithm, and some additional polynomial magic can be invoked.
It turns out that kernel polynomials, of which Pk is a special case, are themselves proportional to orthogonal polynomials for the modified measure (1−λ)dσ(λ) (see proof at the end of the post). This is useful to generate the optimal polynomial with a second-order recursion.
To summarize, if we know the spectral measure dσ, then we can derive a sequence of polynomials Pk that leads to an optimal value for ∫−11Pk(λ)2dσ(λ). However, knowing precisely the spectral density is typically as hard as finding the fixed point of the recursion.
Since convergence properties are dictated by the behavior of the spectral measure around −1 and 1, i.e., by the number of eigenvalues around −1 and 1, we can model the spectral measure by simple distributions with varied behavior at the two ends of the spectrum. A known family is the rescaled Beta distribution, with density proportional to (1−x)α(1+x)β. This will lead to Jacobi polynomials and “simple” formulas below.
Denoting dσ(x)=2α+β+11Γ(α+1)Γ(β+1)Γ(α+β+2)(1−x)α(1+x)βdx the rescaled Beta distribution (with Γ(⋅) the Gamma function), the Jacobi polynomials are orthogonal for the probability measure dσ. That is,
∫−11Jk(α,β)(x)Jℓ(α,β)(x)dσ(x)=0,
if k=ℓ, and equal to αk=2k+α+β+11Γ(α+1)Γ(β+1)Γ(k+1)Γ(k+α+β+1)Γ(α+β+2)Γ(k+α+1)Γ(k+β+1) if k=ℓ. We have the following equivalent αk∼Γ(α+1)Γ(β+1)Γ(α+β+2)2k1 when k tends to infinity. All the formulas in these sections can be obtained from standard references on orthogonal polynomials [2, 3] (with a summary on Wikipedia) and are presented without proofs.
The value at 1 is an important quantity for acceleration, and is equal to:
with coefficients with explicit (and slightly complicated) formulas (in the case you wonder why I use b~ instead of b, this is to avoid overloading the notation with the iteration xk+1=Axk−b):
Jacobi polynomials, as used for the acceleration of gossip algorithms in one-dimension, with (α,β)=(1/2,−1/2).
Jacobi acceleration
We can now apply the polynomial acceleration technique above to the Beta distribution, that is for dσ(x)=2α+β+11Γ(α+1)Γ(β+1)Γ(α+β+2)(1−x)α(1+x)βdx, we have:
Regular recursion error (no acceleration): the error e(Xk)=∫−11λ2kdσ(λ) is asymptotically equivalent to kα+1Cα,β+kβ+1Cβ,α, for some constants Cα,β (see details at the end of the post). Before acceleration, there is thus an equivalent impact of the spectrum around −1 and 1.
Jacobi acceleration error: as shown at the end of the post, the error e(Pk) is equivalent to k2α+2Eα,β for some constant Eα,β.
What’s happening around −1 and 1 is important, and particular the behavior around 1, and we thus see that β is less important for the accelerated version (in fact, using β=0 to construct the Jacobi polynomial, as done in [4], leads to a similar acceleration). In particular, when considering distributions where β=α, then we see that Jacobi acceleration transforms a rate proportional to 1/kα+1 to a rate proportional to 1/k2α+2.
The final recursion is then equal to (see detailed computations at the end of the post):
with initialization y0=x0 and y1=2α+4α+β+3(Ax0–b)+2α+4α+1−βx0. For α=2d−1 and β=0, this exactly recovers the recursion from [4].
Application to gossip
Like in the previous post we consider the gossip problem. For large grid graphs, the gap is small, equivalent to 2d1n2/d1 for the d-dimensional grid. The gap is tending to zero with n, and using acceleration techniques for non-zero gaps, such as Chebyshev acceleration, is not efficient for the earlier iterations.
It turns out that for grid graphs, the spectral measure tends to a limit with behavior (1−x2)d/2−1 around −1 and 1. This is formerly true for the grid graph, and the behavior around 1 (which is the one that matters for acceleration) is the same for a large class of graphs with an underlying geometric structure [4]. This thus corresponds to the Beta distribution of parameters α=β=2d−1.
Below, I consider gossiping on a chain graph with n=200 nodes, and compare regular gossip with Chebyshev acceleration and Jacobi acceleration. In early iterations, Jacobi acceleration is much better.
Gossiping a one-dimensional white noise signal of length n=200, converging to its mean, which is zero. (left) regular gossip, (center) Chebyshev acceleration, (right) Jacobi acceleration
When looking at the convergence rate (plot below), for late iterations, the linear convergence of Chebyshev acceleration does take over; for a method that achieves the best of both world (good in early and late iterations), see [4, Section 7].
Squared gossiping errors (norm between the signal and its average) in natural (left) and logarithmic (right) scale. Chebyshev acceleration is slow at the beginning, and faster at the end (once the error is already quite small).
Similar plots may be made in two dimensions, gossiping a white noise signal, where the stationary behavior is observed much sooner for Jacobi acceleration. Here, Chebyshev acceleration performs worse than the regular iteration because the eigengap is very small (equal to 6×10−4).
Gossiping a two-dimensional white noise signal of size n=64×64=4096, converging to its mean, which is zero. (left) regular gossip, (center) Chebyshev acceleration, (right) Jacobi acceleration.
When gossiping a Dirac signal, we can also observe the spreading of information from the original position of the Dirac to the rest of the grid.
Gossiping a two-dimensional Dirac signal of size n=64×64=4096, converging to its mean. (left) regular gossip, (center) Chebyshev acceleration, (right) Jacobi acceleration. Note that the color scale is different in the three plots.
Conclusion
In this post, I tried to move from the worst-case analysis of spectral acceleration which typically focuses on largest and smallest eigenvalues of the involved contracting operators, closer to an average-case analysis that takes into account the whole spectrum. This led to acceleration by Jacobi polynomials rather than Chebyshev polynomials.
Beyond gossip. While I have focused primarily on applications to gossip where the spectral measure can be well approximated, this can be extended to other situations. For example, Fabian Pedregosa and Damien Scieur [5] recently considered an application of polynomial acceleration to gradient descent for least-squares regression with independent covariates, where the spectral measure of the covariance matrix tends to the famous Marchenko-Pastur distribution (which is close to the rescaled Beta distributions above).
Jacobi polynomials beyond acceleration. In this post, I focused only on the acceleration properties of Jacobi polynomials. There are many more interesting applications of these polynomials in machine learning and associated fields. For example, their role in spherical harmonics to provide an orthonormal basis of the square-integrable functions on the unit sphere in any dimension, is quite useful for the theoretical study of neural networks (see, e.g., [6] and references therein). I would typically say that this is a topic for another post, but this would be even more technical…
Next month, I will probably take a break in the polynomial magic series, and go back to less technical posts.
Acknowledgements. I would like to thank Raphaël Berthier for proofreading this blog post and making good clarifying suggestions.
References
[1] Bernd Fischer. Polynomial based iteration methods for symmetric linear systems. Springer, 1996.
[2] Gábor Szegő. Orthogonal Polynomials. American Mathematical Society, volume 23, 1939.
[3] Theodore Seio Chihara. An Introduction to Orthogonal Polynomials. Gordon and Breach, 1978.
[4] Raphaël Berthier, Francis Bach, Pierre Gaillard. Accelerated Gossip in Networks of Given Dimension using Jacobi Polynomial Iterations. To appear in SIAM Journal on Mathematics of Data Science, 2019.
[5] Fabian Pedregosa, Damien Scieur. Acceleration through Spectral Modeling. NeurIPS workshop “Beyond First Order Methods in ML”, 2019. [04/16/2020] Updated to: Average-case Acceleration Through Spectral Density Estimation, https://arxiv.org/pdf/2002.04756.pdf.
[6] Francis Bach. Breaking the Curse of Dimensionality with Convex Neural Networks. Journal of Machine Learning Research, 18(19):1-53, 2017.
Detailed computations
Kernel polynomial as orthogonal polynomial. We consider a series (Rk) of orthogonal polynomials for the measure (1−λ)dσ(λ). Assuming that Rk=0 (see proof in [4, Appendix D]), then we show that the polynomial Rk(1)Rk(X) is the optimal polynomial of degree k minimizing ∫−11P2(λ)dσ(λ) such that P(1)=1. Indeed, taking any polynomial P of degree k and such that P(1)=1, the polynomial P(X)–Rk(1)Rk(X) vanishes at 1 and can thus be written as A(X)(X−1) with A(X) of degree equal or less than k−1. Then we have:
The second term in the right hand side is equal to zero by orthogonality of (Rk), and the third term is non-negative. Therefore, we must have ∫−11P(λ)2dλ≥∫−11Rk(1)2Rk(λ)2dσ(λ), which shows optimality.
Jacobi recursion. Given the original recursion xk+1=Axk–b, we consider yk=Qk(1)Qk(A)(x0–x∗)+x∗, where Qk=Jk(α+1,β). We get:
which is indeed of the form kα+1Cα,β+kβ+1Cβ,α.
In order to estimate e(Pk), since Pk(X)=∑i=0kαi1Qi(1)Qi(X), we first need an equivalent of the term αi2Qi(1)2∼Γ(α+1)2(i/e)2α(Γ(α+1)Γ(β+1)Γ(α+β+2)2i1)−1∼Eα,β’i2α+1, for some Eα,β’, leading to an error of the form e(Pk)∼Eα,β’∑i=0ki2α+11∼Eα,β’2α+2k2α+21, which is of the desired form.
Spectral density of a grid. As seen at the far end of the previous blog post, the eigenvalues of A for the grid in one-dimension, with m=n, is (up to negligible corrections) –cosmkπ for k=1,…,m. This leads to a limiting spectral measure as –cosθ for θ uniformly distributed on [0,π]. This leads to a spectral density π11−λ21 supported on [−1,1]. In the plot below, we see that the histogram of eigenvalues for a finite m matches empirically this density.
Histogram of eigenvalues for 1D gossip matrix for m=4096, with associated limiting spectral density.
For a d-dimensional grid, with n=md, the spectral density is the one of d1(X1+⋯Xd) for Xi independent and distributed as π11−λ21dλ on [−1,1], for each i=1,…,d. This leads to a convolution power of the density above, rescaled to have support in [−1,1]. This can be shown to lead to behavior as (1−λ2)d/2−1 around 1 and −1 (see [4, Prop. 5.2]).