Reduce data dimension using PCA
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
pca() outputs the coefficient of the variables and principal components of a data. Is there any way to reduce the dimension of the data (340 observations), let say from 1200 dimension to 30 dimension using pca()?
2 commentaires
Réponses (1)
Vassilis Papanastasiou
le 17 Déc 2021
Hi Hg,
What you can do is to use pca directly. Say that X is of size 340x1200 (340 measurements and 1200 variables/dimensions). You want to get an output with reduced dimensionaty of 30. The code below will do that for you:
p = 30;
[~, pca_scores, ~, ~, var_explained] = pca(X, 'NumComponents', p);
- pca_scores is your reduced dimension data.
- var_explained contains the respective variances of each component.
I hope that helps.
0 commentaires
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!