





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






10-725/36-725: Convex Optimization Fall 2015
Lecturer: Ryan Tibshirani Scribes: Bohan Li, Donghan Yu, Ge Huang
Note: LaTeX template courtesy of UC Berkeley EECS dept.
Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Instructor.
Complexity can be expressed in terms of floating point operations or flops required to find the solution. A flop serves as a basic unit of computation, which could denote one addition, subtraction, multiplication or division of floating point numbers. Note that, the flop count is just a rough measure of how expensive an algorithm can be. Many more aspects need to be taken into account to accurately estimate practical runtime. And in practical situations, we’re interested in rough, not exact flop counts to measure the complexity of operations.
In the following sections, we’ll show the flop count of some basic operations.
Given vector a, b ∈ Rn:
However, as said above, the flop count is just a rough measure of how expensive an algorithm can be. For example, setting every element of vector a to 1 costs 0 flops.
Given A ∈ Rm×n, b ∈ Rn, consider Ab:
j aij^ bj^ ,^ (i, j)^ ∈^ S, where^ S^ is the index set of non-zero elements in A. Since |S| = s, the total flop count is 2s. (The worst case is that all the non-zero elements are in the same row)
19-2 Lecture 19: November 5
∑r i=1 uiv T i ∈^ R m×n, Ab = ∑r i=1 ui(v T i b).^ Calculate^ mi^ =^ v T i b, i^ = 1,^ · · ·^ , r^ costs 2nr^ flops. Then scalar multiplication takes mr flops, finally the summation takes mr flops. The total flop count is 2r(m + n).
Given A ∈ Rm×n, B ∈ Rn×p, consider AB:
Given A ∈ Rm×n, B ∈ Rn×p, c ∈ Rp, consider ABc:
Given a non-singular square matrix A ∈ Rn×n^ and a vector b ∈ Rn, consider solving the linear equation, Ax = b. In others words, we intend to determine the cost of computing x = A−^1 b. Note that in Newton’s method, we need to solve ∇^2 f (x)v = −∇f (x), which is exactly this form.
x 1 = b 1 /A 11 x 2 = (b 2 − A 21 x 1 )/A 22
... xn = (bn − An,n− 1 xn− 1 − · · · − An, 1 x 1 )/Ann
19-4 Lecture 19: November 5
So in general, to solve a n dimensional linear equation by a given Cholesky decomposition only needs 2n^2 flops.
Here we perform an analysis on the computational cost of both sides. The case studied here is least square problem shown below as: minβ∈RP ||y − Xβ||^22 → β = (XT^ X)−^1 (XT^ y)
where X ∈ Rnxp, y ∈ Rn.
To solve this linear equation given by the analytical solution, necessary flop numbers are shown in Table 19.1. This shows that Cholesky decomposition is computationally cheaper than QR decomposition.
Figure 19.1: When A is in poor condition, gradient descent will spend a lot of time traversing back and forth “across the valley”, rather than “down the valley”.
From the previous section, it seems that Cholesky decomposition is always better than QR decomposition computationally. However, as we take the numerical robustness, the performance of QR will win over by sensitivity analysis. To start with, consider the linear system Ax = b, with nonsingular A ∈ Rn×n. The singular value decomposition of A is A = UVT, where U,V Rnn are orthogonal, and Σ ∈ Rn×n^ is diagonal with elements σ 1 ≥ ... ≥ σn > 0.
A could be near a singular matrix B even if its full rank, i.e.,
dist(A, Rk) = minrand(B)=k||A − B||op
could be small for some k ¡ n. We can show with SVD analysis that dist(A, Rk) = σk+1. If the value is small, solving x = A−^1 b could be problematic.
Applying SVD we can see that:
x = A−^1 b = V Σ−^1 U T^ b =
∑^ n
i=
viuTi b σi
Lecture 19: November 5 19-
If σi > 0 is small, close to set of rank i-1 matrices, that would pose some problem. In precise sensitivity analysis: fix some F ∈ Rnxn, f ∈ Rn, solve:
(A + F )x() = (b + f )
Theorem 9.1 The solution to the perturbed system satisfies:
||x() − x||^22 ||x|| 2
≤ κ(A)(ρA + ρb) + O(^2 )
where κ(A) = (^) σσ^1 n is the condition number of A, and ρA = || || ||FA^ ||||opop , ρb = || || ||fb^ |||| 22 are the relative errors.
Proof: Differentiating the equation above, let = 0, and solving for dxd. We have:
dx d
(0) = A−^1 (f − F x)
where x = x(0).
Apply Taylor expansion around 0,
x() = x +−^1 (f − F x) + O()^2
Rearrange and we arrive at the inequality,
||x() − x||^22 ||x|| 2
≤ ||||A−^1 ||op(
||f || 2 ||x|| 2
Multiplying and dividing by ||A||Op, and note that κ(A) = ||A||op||A− op^1 , which proves the result.
In linear systems worse conditioning means great sensitivity.
For least squares problems:minβ∈RP ||y − Xβ||^22 , Cholesky solves XT^ Xβ = XT^ y, hence the sensitivity scales with κ(XT^ X) = κ(X)^2. While QR operates on X without forming XT^ X, that sensitivity scales with
κ(X) + ρLS × κ(X)^2 , where ρLS = ||yXˆ||
(^22) .
In summary, Cholesky is cheaper and use less memory, while QR is more stable when ρLS is small and κ(X) is large.
A counterpart to direct methods is indirect methods, which is more aligned with everything so far that we have learned in this course. These are methods which iteractively produce sequence of estimates x(k), k = 1 , 2 , 3.. .. They will converge to a solution when k goes to infinity. They are most often used for very large and sparse systems.
Actually everything that we have learned so far is iterative or indirect rather than exact. The only exception that we have very briefly talked about is the simplex algorithm. It is a direct non-iterative method for linear programs.
So, when to use direct versus indirect? If you have a matrix that you can fit easily in memory, then you should always use direct methods. In such circumstances, there is no point using indirect methods. One should start considering indirect methods when you have a large enough matrix and just get it into memory is a issue.
Lecture 19: November 5 19-
Figure 19.2: When A is in poor condition, gradient descent will spend a lot of time traversing back and forth “across the valley”, rather than “down the valley”.
Convergence Analysis. Well, what can we say about it? As the quadratic objective φ is strongly convex, gradient descent should enjoy linear convergence. It should converge quickly like O(log(1/)).
For this specific problem (solving linear system with gradient descent), we can say much more precise result in terms of the contraction factor.
From one iteration to the next one, if we take a look at the A-norm distance x(k)^ and the solution x, it is the decrease from the previous iteration by the amount of
1 − κ(A)−^1. We can see that the poorer the condition of A, the slower the convergence is.
Formally, we we have the following theorem.
Theorem 19.1 Gradient descent with exact step sizes satisfies
‖x(k)^ − x‖A ≤
1 − κ(A)−^1 ‖x(k−1)^ − x‖A (19.6)
where ‖x‖^2 A = xT^ Ax and κ(A) = λ 1 (A)/λn(A) is the condition number of A.
Proof: The proof is similar to what we did on strong convexity analysis, which was our previous homework. This proof is actually much easier; it is just direct calculation.
And an important note is that the contraction factor here depends adversely on κ(A). To get ‖x(k)^ −x‖A ≤ ‖x(0))^ − x‖A, we require O(κ(A) log(1/)) iterations.
So what is the problem of gradient descent? When κ(A) is large, the contour of this function φ are elongated ellipsoids. Roughly put, gradient descent will spend a lot of time traversing back and forth “across the valley”, rather than “down the valley”, as is illustrated in Fig.19.2. In other words, there is not enough diversity in the descent directions r(k−1)^ = b − Ax(k−1).
Conjugate gradient is an extremely clever idea. The purpose of it is to do something like gradient descent, but use a difference direction p that is constructed to be diverse. That is, to repeat iteration like this one:
x(k)^ = x(k−1)^ + tkp(k−1)^ (19.7)
19-8 Lecture 19: November 5
and pk^ ∈ span
Ap(1),... , Ap(k−1)
. That is, we expect the new direction to be orthogonal to the past directions after they multiplied by the matrix A. Each pair of p’s satisfy A-conjugate with each other. We say p, q are A-conjugate provided pT^ Aq = 0. This explains the name “conjuage gradient”.
Intuition. When we fix the direction p, we are going to do step size optimization. The optimal step size is given by,
tk = arg min t≤ 0
φ(x + tp) =
pT^ r pT^ Ap
Then we plug tk and p into the obejective function φ itself, and get
φ(x(k)) = φ(x(k−1)) −
(p(k))T^ r(k−1) (p(k))T^ Ap(k)^
Now we can observe two conflicting goals in conjugate gradient. First, we require A-conjugacy among the directions p’s. We want to avoid the bad behaviour of gradient descent when the condition of A is poor by imposing diversity. Another kind of conflicting goal is to achieve sufficient alignment between p(k)^ and r(k−1). Note that r(k−1)^ is exactly the direction in gradient descent. If they are not sufficently aligned, their dot product will be small, and the objective function will be decreased only very little.
Turns out these two considerations are simultaneously met with the following iteration rule, which turns out to be very simple
p(k)^ = r(k−1)^ + βkp(k−1), where βk = −
(p(k−1))T^ r(k−1) (p(k−1))T^ Ap(k−1)^
where r(k−1)^ is the previous residual and p(k−1)^ is the previous direction.
Convergence analysis. So what is the convergence analysis for conjugate gradient?
Theorem 19.2 Conjugate gradient method satisfies
‖x(k)^ − x‖A ≤ 2
κ(A) − 1 √ κ(A) + 1
)k ‖x‖A (19.11)
where as before‖x‖^2 A = xT^ Ax and κ(A) = λ 1 (A)/λn(A) is the condition number of A. Further, it finds the exact solution x in at most n iterations.
Proof: It is much much harder than gradient descent. Actually it is a classic topic. Just in recent years people have found different and new proofs which invokes Chebyshev polynomials and leads to other interesting algorithms.
We see that conjugate gradient too enjoys linear convergence but with a contraction factor that has a better dependence on κ(A). To get ‖x(k)^ − x‖A ≤ ‖x(0))^ − x‖A, we require O(
κ(A) log(1/)) iterations. For
poorly conditioned A, the difference between O(κ(A)) and O(
κ(A)) can be a big deal.
Here we conduct comparison of iterative methods for least squares problems: 100 i.i.d. standard Gaussian random instances with n = 100, p = 20. It is not a poorly conditioned system by the way.