Tutorials › Multi-Omics Data Integration › Sparse CCA Objectives and Constraints

Canonical Correlation and Partial Least Squares · Tutorial 142 of 597

Sparse CCA Objectives and Constraints

Learn how L1 constraints and penalties change CCA’s optimization objective, encourage sparse weight vectors, and affect the interpretation of selected variables.

Intermediate 10 min read

What You'll Learn

  • State constrained and penalized sparse CCA objectives and their normalization requirements.
  • Explain how L1 constraints can limit the number of nonzero canonical weights.
  • Calculate sparse objectives from a small cross-covariance matrix.
  • Distinguish correlation-based sparse CCA from covariance-based alternatives.
  • Identify scaling, stability, and interpretation pitfalls in sparse solutions.

Why Add Sparsity to CCA?

Canonical correlation analysis (CCA) finds linear combinations of two data blocks whose scores are strongly associated. In a multi-omics analysis, each block may contain many measured features, and an ordinary CCA weight vector can assign nonzero weights to nearly all of them. That can make the resulting combinations difficult to summarize and unstable when features are numerous or correlated.

Sparse CCA modifies the optimization problem so that some weights are exactly zero. The remaining nonzero weights identify features that contribute to the fitted combinations. This is a form of variable selection, not proof that selected features are biologically causal or uniquely important. The central design choice is how to encourage zeros while preserving a well-defined association objective.

Definition: Let \(\mathbf{X}\) and \(\mathbf{Y}\) be two centered data blocks measured on the same \(n\) observational units, with \(p\) and \(q\) features. Let \(S_{xx}\), \(S_{yy}\), and \(S_{xy}\) denote their sample covariance matrices. For weight vectors \(\mathbf{a}\in\mathbb{R}^{p}\) and \(\mathbf{b}\in\mathbb{R}^{q}\), the canonical scores are \(\mathbf{X}\mathbf{a}\) and \(\mathbf{Y}\mathbf{b}\). The support of a weight vector is the set of indices of its nonzero entries. Sparse CCA seeks associated scores while constraining or penalizing the weights to encourage small supports.

Correlation Objectives With L1 Constraints

The sample correlation between the two scores is

$$ \operatorname{cor}(\mathbf{X}\mathbf{a},\mathbf{Y}\mathbf{b}) = \frac{\mathbf{a}^{\mathsf T}S_{xy}\mathbf{b}} {\sqrt{(\mathbf{a}^{\mathsf T}S_{xx}\mathbf{a})(\mathbf{b}^{\mathsf T}S_{yy}\mathbf{b})}}. $$

This expression is unchanged if either weight vector is multiplied by a positive constant. Therefore, an L1 bound alone would not restrict the solution: a vector could simply be rescaled to meet the bound without changing the correlation. The usual correlation-based constrained formulation fixes each score variance to one and then imposes L1 bounds:

$$ \begin{aligned} \text{maximize}_{\mathbf{a},\mathbf{b}}\quad &\mathbf{a}^{\mathsf T}S_{xy}\mathbf{b}\\ \text{subject to}\quad &\mathbf{a}^{\mathsf T}S_{xx}\mathbf{a}=1,\qquad \mathbf{b}^{\mathsf T}S_{yy}\mathbf{b}=1,\\ &\|\mathbf{a}\|_1\leq c_x,\qquad \|\mathbf{b}\|_1\leq c_y. \end{aligned} $$

Under the variance constraints, the objective is the score correlation. Here \(\|\mathbf{a}\|_1=\sum_j|a_j|\), and \(c_x,c_y\) set the allowed L1 sizes. The constants must be large enough for the corresponding variance constraint to be feasible. A tighter bound generally restricts the weights more strongly, though it does not always produce a strictly smaller support at every value of the bound.

A common penalized version keeps the variance normalizations but subtracts L1 costs from the objective:

$$ \text{maximize}_{\mathbf{a},\mathbf{b}}\quad \mathbf{a}^{\mathsf T}S_{xy}\mathbf{b} -\lambda_x\|\mathbf{a}\|_1-\lambda_y\|\mathbf{b}\|_1 \quad \text{subject to}\quad \mathbf{a}^{\mathsf T}S_{xx}\mathbf{a}=1,\ \mathbf{b}^{\mathsf T}S_{yy}\mathbf{b}=1. $$

The nonnegative parameters \(\lambda_x\) and \(\lambda_y\) control the penalty strengths. This penalized objective is not itself the unpenalized score correlation: it trades off association against weight complexity. A constrained formulation and a penalized formulation express related preferences, but their tuning parameters are not generally interchangeable by a simple conversion.

Why L1 can select variables: The L1 norm has corners on coordinate axes. Under a sufficiently restrictive constraint, an optimizer can lie on one of those corners, giving one or more weights exactly equal to zero. The L1 norm encourages sparsity; it does not guarantee a particular number of selected features unless the optimization problem and constraints imply that result.

Worked Example: A Constraint That Forces Single-Feature Weights

Suppose \(S_{xx}=I_3\) and \(S_{yy}=I_2\), where \(I_k\) is the \(k\)-dimensional identity matrix, and the cross-covariance matrix is

$$ S_{xy}= \begin{pmatrix} 0.80&0.10\\ 0.70&0.05\\ 0.05&0.90 \end{pmatrix}. $$

Use the constrained objective with \(c_x=c_y=1\). Because the within-block covariance matrices are identity matrices, the variance constraints are \(\|\mathbf{a}\|_2=1\) and \(\|\mathbf{b}\|_2=1\). For any vector, \(\|\mathbf{a}\|_1\geq\|\mathbf{a}\|_2\). Equality holds only when at most one entry is nonzero. Thus the L1 bounds force each weight vector to have exactly one nonzero entry, since its L2 norm is one.

For any such pair of vectors, the objective is one entry of \(S_{xy}\), up to sign. All entries here are positive, so the largest value is \(0.90\), at row 3 and column 2. The optimizing weights are \(\mathbf{a}=(0,0,1)^{\mathsf T}\) and \(\mathbf{b}=(0,1)^{\mathsf T}\), giving \(\mathbf{a}^{\mathsf T}S_{xy}\mathbf{b}=0.90\). Under these identity covariance matrices, this is a score correlation of \(0.90\). The fitted pair uses the third feature in the first block and the second feature in the second block.

What the Penalty Changes

A penalty makes the cost of a weight depend on its absolute size. Since the L1 norm sums absolute weights, adding a feature with a small nonzero weight can still incur a cost. This differs from merely reporting a dense solution and then dropping small coefficients afterward: the penalty changes which solution is optimal in the first place.

For intuition, consider a candidate with unit-length weights in both blocks and identity within-block covariance matrices. For this candidate, the penalized objective is its cross-covariance score minus \(\lambda_x\|\mathbf{a}\|_1+\lambda_y\|\mathbf{b}\|_1\). The following calculation compares particular candidates; it does not assert that these candidates exhaust all possible weight vectors.

Worked Example: Comparing Candidate Penalized Objectives

Use the cross-covariance matrix from the previous example and set \(\lambda_x=\lambda_y=0.15\). Compare the single-feature candidate \(\mathbf{a}=(0,0,1)^{\mathsf T},\ \mathbf{b}=(0,1)^{\mathsf T}\) with the two-feature candidate \(\mathbf{a}=(1/\sqrt{2},0,1/\sqrt{2})^{\mathsf T},\ \mathbf{b}=(0,1)^{\mathsf T}\).

For the single-feature candidate, the cross-covariance score is \(0.90\), and both L1 norms equal \(1\). Its penalized objective is

$$ 0.90-0.15(1)-0.15(1)=0.60. $$

For the two-feature candidate, the score is \((0.10+0.90)/\sqrt{2}\approx0.7071\). Its L1 norms are \(\sqrt{2}\approx1.414\) and \(1\), so its objective is

$$ 0.7071-0.15(1.414)-0.15(1) \approx 0.345. $$

Among these two candidates, the single-feature candidate has the larger penalized objective. The calculation illustrates why a penalty can favor a smaller support. To identify the optimizer, one must compare against all feasible candidates; this two-candidate comparison alone does not establish a global optimum.

Normalization, Scaling, and the Meaning of the Objective

The L1 constraints act on weights, so their practical effect depends on how features are scaled. If one feature is measured in large numerical units and another in small units, the corresponding weights can have different magnitudes for reasons unrelated to scientific importance. A common preparation is to center and scale features before fitting, while checking that this choice is suitable for the measurement types and scientific question. The covariance matrices and all weights must then be interpreted on that chosen scale.

The importance of normalization is also visible when the within-block covariance matrices are not identity matrices. The cross-covariance entry alone does not give the correlation between a pair of individual features. That correlation divides the cross-covariance by the product of their standard deviations.

Worked Example: Why Raw Cross-Covariance Can Mislead

Suppose

$$ S_{xx}= \begin{pmatrix}4&0\\0&1\end{pmatrix},\quad S_{yy}= \begin{pmatrix}9&0\\0&1\end{pmatrix},\quad S_{xy}= \begin{pmatrix}3&0\\0&0.80\end{pmatrix}. $$

The cross-covariance between the first feature of each block is \(3\), which is larger than the second pair's cross-covariance of \(0.80\). But the first pair has standard deviations \(2\) and \(3\), so its correlation is

$$ \frac{3}{\sqrt{4}\sqrt{9}}=\frac{3}{6}=0.50. $$

The second pair has standard deviations \(1\) and \(1\), giving correlation \(0.80/(\sqrt{1}\sqrt{1})=0.80\). Thus the larger raw covariance does not imply the stronger standardized association. This calculation compares individual feature pairs; it does not claim that either pair is the global sparse CCA solution, since that also depends on the allowed combinations of weights and the L1 constraints.

Assumptions, Diagnostics, and Alternatives

The optimization itself is a descriptive procedure and does not require normally distributed measurements. It does require matched rows across the two blocks: each row of \(\mathbf{X}\) must correspond to the same observational unit as the row of \(\mathbf{Y}\). Centering, scaling, missing-data handling, and any removal of zero-variance features should be decided before fitting and applied consistently.

For the variance-normalized formulation, each chosen weight vector must yield a well-defined, nonzero score variance. Positive-definite within-block covariance matrices make the normalization straightforward. If a covariance matrix is singular, some directions may have zero variance or may not be uniquely normalized; sparse constraints do not automatically solve that issue. Inspect the covariance structure and use an appropriate regularized formulation if necessary.

Useful diagnostics include checking the scale of each feature, the number of nonzero weights in each block, sensitivity of the supports to modest changes in the constraints or penalties, and the size of the association on data not used to choose the weights. Highly correlated features can exchange weight or selection across fits, so a selected support need not be stable even when the overall score association is similar. A strong in-sample objective is not, by itself, evidence that the association will replicate.

ApproachObjective or emphasisTrade-off
Classical CCAMaximizes score correlation without sparsity penalties.Uses all features freely; can be difficult to interpret or unstable in high dimensions.
Sparse CCACombines score association with L1 constraints or costs on both weight vectors.Can produce selected supports, but results depend on scaling and sparsity choices.
Ridge CCARegularizes the covariance-based normalization to stabilize estimation.Can improve stability but generally does not set weights exactly to zero.
PLSTargets covariance between block scores rather than CCA's variance-normalized score correlation.May suit a covariance-focused goal; it answers a different optimization question.

A common mistake is to treat an L1 penalty as a cosmetic adjustment to a classical CCA solution, or to interpret every selected feature as uniquely important. The correction is that the penalty changes the optimization trade-off, and correlated features may substitute for one another. Sparse CCA provides a compact fitted representation under chosen modeling and scaling decisions; it does not establish causation, guarantee support stability, or automatically provide valid inferential conclusions.

Key takeaway: A correlation-based sparse CCA formulation must fix the score variances as well as constrain or penalize the L1 sizes of both weight vectors. L1 regularization can create exact zeros, but the selected supports depend on the objective, feature scales, covariance structure, and sparsity settings.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. Why are variance normalizations needed when an L1 constraint is used with a correlation objective?
  2. With identity within-block covariance matrices and unit L2 norms, what does an L1 bound of \(1\) imply about each weight vector?
  3. For a candidate whose cross-covariance score is \(0.75\), whose two L1 norms are \(1.2\) and \(1\), and whose penalties are both \(0.10\), calculate its penalized objective.
  4. Two individual feature pairs have cross-covariances \(2\) and \(1\). Their respective standard deviations are \((2,2)\) and \((1,1)\). Which pair has the higher correlation?
  5. Name one reason why a sparse CCA support may change across fits even if the overall association is similar.

Solutions. (1) Correlation is unchanged by rescaling either weight vector, so an L1 bound without a scale-fixing condition can be met by rescaling and does not meaningfully constrain the correlation solution. (2) The L1 norm is at least the L2 norm, with equality only when at most one entry is nonzero. Since the L2 norm is \(1\), the bound forces exactly one nonzero entry in each vector. (3) The objective is \(0.75-0.10(1.2)-0.10(1)=0.53\). (4) The first correlation is \(2/(2\cdot2)=0.50\); the second is \(1/(1\cdot1)=1.00\), so the second pair has the higher correlation. (5) Highly correlated features can substitute for one another, making the selected support sensitive to small changes in the data or sparsity settings.

Clinical Biostats