The interview problem

Practice prompt

Explain how CCA finds related directions in two views and why high training correlation can be misleading.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume paired observations in two feature spaces. Center each view and find linear projections maximizing their correlation subject to variance normalization and successive-component constraints. Fit projections only on training pairs, then evaluate correlation on held-out pairs. Regularization or dimension reduction may be necessary when covariance estimates are singular. Pairing is part of the data contract, not an incidental row order.

2. Trace the design or derivation

Align paired rows
  → center views
  → regularize covariances
  → learn projections
  → test new pairs

If both views contain a timestamp trend, a high canonical correlation may merely recover that trend. Compare with a nuisance-only baseline or remove the trend under a training-fitted transformation. Whether this is desirable depends on the intended use: cross-view prediction and discovering new shared structure are different objectives.

3. Calculate the example

If a held-out projected pair is u=(−1,0,1) and v=(−2,0,2), their correlation is 1 even though their scales differ. Doubling v does not change correlation, so maximizing CCA correlation does not identify an absolute scale mapping.

4. Failure cases and trade-offs

Many features and few pairs can produce high in-sample correlations by overfitting. Mispaired rows destroy the intended cross-view relationship. Linear CCA is easier to inspect than nonlinear alternatives but misses nonlinear dependence. Shared nuisance variables can also drive strong association without useful task information.

5. Validation, follow-ups and self-review

Shuffle pairing as a negative control and inspect out-of-sample performance. Follow-up: how would you use CCA when one view is missing at inference? Self-review: explain normalization, regularization and the pairing assumption.

Sources and related practice

Technical reference: scikit-learn.org — Canonical correlation and related cross-view methods.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with PCA and dimensionality reduction; Balance competing tasks in one model.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.