7.2 Canonical Correlation Analysis
Find paired directions that co-vary across two views.
These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.
Figures and notes follow Deisenroth, Faisal, and Ong, Mathematics for Machine Learning; Theodoridis; and Géron.
1. Canonical correlation analysis (CCA)
PCA reduces dimension for one data set. Often you have several related sets from different sources.
Canonical correlation analysis (CCA) processes two sets together. The correlation of two random vectors depends on the coordinate system you write them in.
CCA looks for a pair of linear maps, one per set, so that the transformed variables are maximally correlated.
Two objects to keep straight:
- Canonical variables (variates)
- Canonical correlation
2. The math
Two random vectors and , observations for .
As in PCA, start with one pair of directions, and , that maximize the correlation of the projections.
Equivalently, the constrained problem
where is the cross-covariance.
Compared with PCA: two directions, not one; the constraints use a weighted norm, not the Euclidean norm; the objective is correlation of the two projections, not variance of one.
Lagrangian:
Gradients in and set to zero give and
Solve the second for (assuming invertible) and substitute:
and
If is invertible too, this is an ordinary eigenproblem:
So is an eigenvector of that product. Take the eigenvector for the largest eigenvalue to maximize the correlation.
and are the normalized canonical correlation basis vectors. The eigenvalue is the squared canonical correlation. The projections and are the canonical variates.
3. What to read off in practice
Two questions after you fit CCA:
- Canonical correlation. How much is each canonical variable from set 1 correlated with its counterpart in set 2?
- Canonical variates. Which original variables does each variate represent?
Practice
-
CCA needs two views of the same objects. Name a pair.
-
What is CCA maximizing that PCA is not, and what replaces the unit-Euclidean constraint?
-
After you compute , how do you get ?