Skip to content

PCA projection without covariance inversion

Question

Implement a training-only PCA fit and projection using SVD. Return k feature directions and explain what must be reused on test data.

Short answer

Centre with the training mean and use the first k right singular vectors as feature directions. Test rows must reuse both the mean and directions. Singular-vector signs can differ without changing the represented subspace.

Original question and answer written by SelfMadeQuant.com.

See the hint and the full worked solution in the question bank (free account).

Open the worked solution

Lessons behind this question

Start with a free lesson: Expectation, Variance and Covariance is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.

Read it free