Why after programming the coeff of the dataset, I get only part of the coeff of the dataset?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
千惠 洪
am 25 Aug. 2020
Beantwortet: Adam Danz
am 25 Aug. 2020
There is a 20*7 dataset and i try to get the coeff of it. But after I run the program, the output only provides me with a 7*7 coeff array.
[coeff, score, latent, tsquared, explained] = pca(mArray);
coeffArray = coeff;
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 25 Aug. 2020
From the documentation:
coeff = pca(X) returns the principal component coefficients, also known as loadings, for the n-by-p data matrix X. Rows of X correspond to observations and columns correspond to variables. The coefficient matrix is p-by-p.
In your case, your data are 20*7 and the output is 7*7 as expected.
If you were expecting 20 coefficients, transpose the input.
[. . .] = pca(mArray.');
See the link above for a detailed explanation of the output and several examples.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!