Azzera filtri
Azzera filtri

Scaling new data to preoject them onto my PCA space

11 visualizzazioni (ultimi 30 giorni)
Rini
Rini il 8 Apr 2021
Risposto: Sai Pavan il 19 Apr 2024
Hello there!
I have a dataset of 30 datasets and around 60 observations. I perform PCA and keep the first two Principal Components, so I project my scores onto them.
Then I try to project a point, that comes from a different PCA analysis onto the axis that I previously created, but am unable to scale it. What is the proper way to tackle this issue?
Thank you in advance!

Risposte (1)

Sai Pavan
Sai Pavan il 19 Apr 2024
Hello Rini,
I understand that you want to scale new data points to project them onto the PCA space obtained from a different dataset. To project a new point onto the principal component, we need to follow a process that involves scaling the new point according to the original PCA's scaling parameters, and then projecting it using the principal component vectors (eigenvectors) from the original PCA.
Please refer to the below code snippet that illustrates the process:
[coeff, ~, ~, ~, ~, mu] = pca(originalData);
coeff = coeff(:, 1:2); % Keep the first two principal components
stddev = std(originalData); % Calculate standard deviation of the original dataset
newPointStandardized = (newPoint - mu) ./ stddev; % Standardize the new point
newPointProjected = newPointStandardized * coeff; % Project the new point onto the PCA axes
Hope it helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by