フィルターのクリア

The size of my PCA isn't correct

8 ビュー (過去 30 日間)
Héctor
Héctor 2016 年 1 月 18 日
コメント済み: Frank Nylander 2024 年 2 月 4 日
I am trying to perform principal component analysis using pca and not princomp. My dataset consists of 303 samples each containing 3904 dimensions, which explains why I want to perform PCA. My data is in a matrix called Data which has a size of 303 (rows) by 3904 (columns). When I execute the PCA command with
[coeff,score] = pca(Data);
I am returned a matrix coeff of size 3904*302 and the matrix score is of size 303*302 which doesn't seem to be correct right? Online documentation suggests that coeff should be 3904*3904 (i.e. square with the dimension size of the variables, here the columns). What is going wrong here?
ps: I also tried transposing the data and this results in a coeff matrix of 303*303

回答 (1 件)

Roger Wohlwend
Roger Wohlwend 2016 年 1 月 19 日
It seems that Matlab expects a Matrix with more observations than variables (i.e. more rows than columns). As you violate that rule (only 303 observations for 3904 variables), Matlab transposes the Matrix in order to obtain a Matrix with more observations than variables. If you transpose the Matrix, Matlab interprets your variables as observations and the other way around. So the result is not valid. You cannot solve this Problem. If you don't have more than 303 observations, your Matrix must not have mor than 303 columns.
  1 件のコメント
Frank Nylander
Frank Nylander 2024 年 2 月 4 日
Has this been fixed? I'm getting the same problem.

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

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by