Reduce data dimension using PCA

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 件のコメント

Adam
Adam 2016 年 11 月 7 日
You should just be able to keep the 30 largest components from running pca.
Hg
Hg 2016 年 11 月 8 日
I use
[residuals,reconstructed] = pcares(X,ndim)

サインインしてコメントする。

回答 (1 件)

Vassilis Papanastasiou
Vassilis Papanastasiou 2021 年 12 月 17 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

質問済み:

Hg
2016 年 11 月 7 日

回答済み:

2021 年 12 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by