Tutorials › Multi-Omics Data Integration › Alternating Algorithms for Sparse CCA

Canonical Correlation and Partial Least Squares · Tutorial 143 of 597

Alternating Algorithms for Sparse CCA

See how alternating sparse CCA updates each weight vector in turn, preserves the constraints, and checks whether the objective is stabilizing.

Intermediate 11 min read

What You'll Learn

  • Define blockwise sparse CCA updates using covariance normalization and L1 bounds.
  • Check whether an initialization and each update satisfy all constraints.
  • Work through an alternating iteration with hypothetical covariance matrices.
  • Explain why exact block updates make the objective nondecreasing.
  • Distinguish objective convergence from convergence to a global optimum.
  • Recognize common diagnostic signals of infeasible or unstable updates.

Why Alternate Between the Two Weight Vectors?

In sparse canonical correlation analysis (sparse CCA), each block of measurements is summarized by a weighted score. The two weight vectors are chosen to find scores that are strongly associated while limiting the number or size of their nonzero coefficients. The central computational difficulty is that the two vectors are coupled: changing one changes which values of the other are useful.

An alternating algorithm handles this coupling by optimizing one vector while holding the other fixed, then reversing their roles. Each step is a constrained optimization problem. The method is useful only if the updates respect both the covariance normalization and the sparsity constraints; normalizing a vector alone does not guarantee that it is feasible.

Definition: Let \(X\) and \(Y\) be centered data matrices measured on the same \(n\) individuals, with \(p\) and \(q\) variables. Write \(S_{xx}=X^\mathsf{T}X/(n-1)\), \(S_{yy}=Y^\mathsf{T}Y/(n-1)\), and \(S_{xy}=X^\mathsf{T}Y/(n-1)\). For weight vectors \(a\in\mathbb{R}^p\) and \(b\in\mathbb{R}^q\), sparse CCA in this tutorial maximizes \(a^\mathsf{T}S_{xy}b\), subject to \(a^\mathsf{T}S_{xx}a=1\), \(b^\mathsf{T}S_{yy}b=1\), \(\|a\|_1\leq c_x\), and \(\|b\|_1\leq c_y\). The constants \(c_x,c_y\) are the sparsity bounds.

The covariance-normalization constraints make the two score variances equal to one. Consequently, \(a^\mathsf{T}S_{xy}b\) is the sample correlation between the scores \(Xa\) and \(Yb\). The \(L_1\) bounds restrict the weights and can encourage zero coefficients. A feasible pair must satisfy all four constraints simultaneously.

Block Updates and Their Assumptions

Assume the observations in the two blocks are matched and centered in the same way, and that \(S_{xx}\) and \(S_{yy}\) are positive definite. When the starting pair is feasible, each block feasible set is nonempty. Positive definiteness makes each covariance-normalized set bounded, and the constraints define closed feasible sets; thus each block feasible set is compact, so its continuous objective attains a maximum. If covariance matrices are singular, additional care is needed; the positive-definite assumption here avoids that complication.

Starting from a feasible pair \((a^{(0)},b^{(0)})\), an exact alternating iteration is defined by these block maximizations:

$$ a^{(t+1)}\in\operatorname*{arg\,max}_{a:\,a^\mathsf{T}S_{xx}a=1,\ \|a\|_1\leq c_x} a^\mathsf{T}S_{xy}b^{(t)},\qquad b^{(t+1)}\in\operatorname*{arg\,max}_{b:\,b^\mathsf{T}S_{yy}b=1,\ \|b\|_1\leq c_y} (a^{(t+1)})^\mathsf{T}S_{xy}b. $$

The first update chooses the best feasible \(a\) for the current \(b^{(t)}\); the second chooses the best feasible \(b\) for the updated \(a^{(t+1)}\). If a subproblem has multiple maximizers, a consistent tie-breaking rule helps make the numerical output reproducible. The signs of both vectors matter only through their product: flipping both signs leaves the objective unchanged. A convention such as choosing signs so that the reported covariance is nonnegative can make results easier to compare.

In practice, an update may be obtained by a numerical solver or an approximate block procedure. In either case, check feasibility after every update. A Euclidean normalization is not generally the same as covariance normalization unless the relevant covariance matrix is the identity. Also, rescaling a vector to satisfy its covariance constraint can change its \(L_1\) norm, so both conditions must be checked after normalization.

Worked Example: One Alternating Iteration

Consider a hypothetical centered data set whose covariance matrices are \(S_{xx}=I_2\), \(S_{yy}=I_2\), and \(S_{xy}=\begin{pmatrix}0.8&0.2\\0.1&0.7\end{pmatrix}\). Use \(c_x=c_y=1.5\), and start at \(a^{(0)}=(1,0)^\mathsf{T}\) and \(b^{(0)}=(0.8,0.6)^\mathsf{T}\). These are feasible: each has Euclidean norm one, and their \(L_1\) norms are \(1.0\) and \(1.4\), both at most \(1.5\). The displayed covariance blocks are compatible with a joint covariance matrix because the largest singular value of \(S_{xy}\) is less than one.

Since \(S_{xx}=I_2\), the first covariance constraint is \(\|a\|_2=1\). With \(b^{(0)}\) fixed, the unconstrained direction is \(S_{xy}b^{(0)}\):

$$ S_{xy}b^{(0)} = \begin{pmatrix}0.8&0.2\\0.1&0.7\end{pmatrix} \begin{pmatrix}0.8\\0.6\end{pmatrix} = \begin{pmatrix}0.76\\0.50\end{pmatrix}, \qquad \left\|S_{xy}b^{(0)}\right\|_2 =\sqrt{0.76^2+0.50^2} =\sqrt{0.8276} \approx 0.9097. $$

The unit vector in this direction is \(a^{(1)}\approx(0.8354,0.5496)^\mathsf{T}\). Its \(L_1\) norm is approximately \(1.385\), so it meets the bound \(1.5\). The objective rises from \((a^{(0)})^\mathsf{T}S_{xy}b^{(0)}=0.76\) to approximately \(0.9097\).

Now hold \(a^{(1)}\) fixed. The direction for the \(b\) update is \(S_{xy}^\mathsf{T}a^{(1)}\):

$$ S_{xy}^\mathsf{T}a^{(1)} \approx \begin{pmatrix} 0.8(0.8354)+0.1(0.5496)\\ 0.2(0.8354)+0.7(0.5496) \end{pmatrix} = \begin{pmatrix}0.7233\\0.5518\end{pmatrix}. $$

Its norm is approximately \(0.9098\), giving \(b^{(1)}\approx(0.7950,0.6066)^\mathsf{T}\). The \(L_1\) norm is approximately \(1.402\), still below \(1.5\). This completes one feasible alternating iteration. The updated objective is approximately \(0.9098\). These values illustrate the block updates; they do not imply that the pair is a global optimum.

Why the Objective Does Not Decrease

For exact block maximizations, monotonicity follows directly from feasibility. The old \(a^{(t)}\) remains a permissible candidate in the \(a\) subproblem, so the new \(a\) cannot produce a smaller objective at the fixed \(b^{(t)}\). Next, \(b^{(t)}\) remains permissible in the \(b\) subproblem, so that update cannot reduce the objective either.

$$ (a^{(t+1)})^\mathsf{T}S_{xy}b^{(t)} \geq (a^{(t)})^\mathsf{T}S_{xy}b^{(t)}, \qquad (a^{(t+1)})^\mathsf{T}S_{xy}b^{(t+1)} \geq (a^{(t+1)})^\mathsf{T}S_{xy}b^{(t)}. $$

The objective is also bounded above by one in this covariance-normalized formulation. The covariance Cauchy–Schwarz inequality gives \(\left|a^\mathsf{T}S_{xy}b\right|\leq\sqrt{a^\mathsf{T}S_{xx}a}\sqrt{b^\mathsf{T}S_{yy}b}=1\). Therefore, the sequence of objective values from exact updates is nondecreasing and bounded, and hence converges. This statement concerns objective values; it does not by itself prove that the weight vectors converge, that the limit is unique, or that it is a global maximum.

Worked Example: A Binding Sparsity Constraint

Suppose \(S_{xx}=S_{yy}=I_2\), \(S_{xy}=\begin{pmatrix}0.8&0\\0&0.5\end{pmatrix}\), and \(c_x=c_y=1\). Begin with the feasible vectors \(a^{(0)}=(1,0)^\mathsf{T}\) and \(b^{(0)}=(0,1)^\mathsf{T}\). Each has covariance norm one and \(L_1\) norm one, and the initial objective is zero.

For a unit vector in two dimensions, \(\|a\|_1\geq\|a\|_2=1\). Thus the bound \(\|a\|_1\leq1\) forces one coordinate to be zero; the only feasible vectors are signed coordinate vectors. With \(b^{(0)}=(0,1)^\mathsf{T}\), the objective is \(0.5a_2\), so the maximizing feasible choice is \(a^{(1)}=(0,1)^\mathsf{T}\). Holding that vector fixed, the objective is \(0.5b_2\), so the maximizing update is \(b^{(1)}=(0,1)^\mathsf{T}\). The objective has increased from \(0\) to \(0.5\), and both updated vectors satisfy both constraints. This example shows how a binding \(L_1\) bound can produce a sparse solution.

Monitoring Updates and Recognizing Failure

A practical implementation should monitor more than the objective. At each iteration, record the objective, both covariance norms, and both \(L_1\) norms. Also record the number of nonzero coefficients, using a stated numerical tolerance when values are very small. A useful stopping rule requires the objective change to be small relative to its scale for several iterations and the constraints to remain satisfied. For example, one may stop when \(|J^{(t+1)}-J^{(t)}|/\max(1,|J^{(t)}|)\) is below a chosen tolerance, while separately verifying the constraints. The tolerance is a computational choice, not a guarantee of statistical accuracy.

1
Check the initialization.
Verify both covariance-normalization equalities and both \(L_1\) inequalities before the first update. An infeasible starting pair invalidates the simple monotonicity argument.
2
Check each block result.
After updating one vector, calculate its covariance norm and \(L_1\) norm. Do not assume that normalizing for one constraint preserves the other.
3
Track the objective and supports.
Large objective drops can signal an inaccurate update, a sign or indexing error, or a violation of the constraints. A stable objective with changing supports can signal non-unique or nearly tied solutions.

For instance, with \(S_{xx}=\operatorname{diag}(4,1)\), the vector \(a=(0.4,0.6)^\mathsf{T}\) has covariance norm \(\sqrt{4(0.4)^2+(0.6)^2}=1\) and \(L_1\) norm \(1.0\). A proposed \(b=(0.8,0.6)^\mathsf{T}\) has Euclidean—and thus covariance—norm one if \(S_{yy}=I_2\), but its \(L_1\) norm is \(1.4\). With \(c_y=1.2\), this pair is not feasible. Replacing it with \(b=(\sqrt{0.99},0.1)^\mathsf{T}\) gives covariance norm one and \(L_1\) norm approximately \(1.095\), so the replacement is feasible. This check matters because a plausible-looking normalized vector can still violate the sparsity bound.

How Alternation Compares With Other Choices

Classical CCA solves a non-sparse covariance-normalized problem and can be computed through matrix factorizations when its required conditions hold. Sparse CCA adds constraints that make the optimization non-smooth and can produce interpretable zero patterns, but its alternating optimization may settle at a local solution and may depend on initialization. Ridge-regularized CCA instead stabilizes the problem by penalizing or regularizing weights; it does not impose the same direct \(L_1\) sparsity bounds. PLS maximizes covariance under a different normalization and objective, so its weight vectors should not be interpreted as solutions to this sparse CCA problem.

Alternating updates are attractive because each step focuses on one block and the objective can be monitored. Their limitations are equally important: objective monotonicity is not a proof of global optimality, and a converged objective does not establish that selected variables are stable across samples. In applications, initialization sensitivity, small changes in the objective, and support changes should all be reported or investigated rather than hidden by a single stopping criterion.

Common Mistakes

  • Calling an initialization feasible after checking only one constraint. Feasibility requires both covariance normalization and the relevant \(L_1\) bound for each vector.
  • Using Euclidean normalization automatically. It is correct only when the corresponding covariance matrix is the identity; otherwise use the covariance norm.
  • Assuming each alternating run finds the global solution. Blockwise improvement and objective convergence do not establish global optimality.
  • Treating a stable objective as proof of stable weights. Multiple or nearly tied block maximizers can have similar objective values but different supports.
Key takeaway: An alternating sparse CCA iteration is a pair of constrained block optimizations. Start feasible, verify both constraints after every update, and interpret a nondecreasing converged objective as evidence of numerical stabilization—not as proof of a unique or globally optimal solution.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. What two conditions must an updated \(a\) satisfy in the formulation above?
  2. Why does an exact update of \(b\) not decrease the objective after the \(a\) update?
  3. If \(S_{xx}=I\), \(a=(0.6,0.8)^\mathsf{T}\), and \(c_x=1.3\), is \(a\) feasible?
  4. What can objective convergence establish, and what does it not establish?

Solutions. (1) It must satisfy \(a^\mathsf{T}S_{xx}a=1\) and \(\|a\|_1\leq c_x\). (2) The old \(b\) is a feasible candidate in the updated \(b\) subproblem, so maximizing over feasible \(b\) cannot give a smaller objective. (3) No: \(0.6^2+0.8^2=1\), but \(0.6+0.8=1.4>1.3\), so it is not feasible. (4) For exact updates, it establishes convergence of the bounded, nondecreasing objective sequence; it does not establish convergence of the weights, uniqueness, or global optimality.

Clinical Biostats