pca() not working as advertised
Afficher commentaires plus anciens
When consulting the documentation for the pca() function, I tried the following example:
load hald
The ingredients data has 13 observations for 4 variables.
Find the principal components for the ingredients data.
load hald
coeff = pca(ingredients)
coeff =
-0.0678 -0.6460 0.5673 0.5062
-0.6785 -0.0200 -0.5440 0.4933
0.0290 0.7553 0.4036 0.5156
0.7309 -0.1085 -0.4684 0.4844
The rows of coeff contain the coefficients for the four ingredient variables, and its columns correspond to four principal components.
However on my machine, I get this output for the same commands:
load hald
coeff = pca(ingredients)
coeff =
517.7969
67.4964
12.4054
0.2372
Does anyone know why this is happening? I am running the latest version of Matlab r2016b on Ubuntu 16.04
Réponses (1)
KSSV
le 22 Nov 2016
Try
[pc,score,latent,tsquare] = princomp(ingredients);
5 commentaires
Alexander Tarroni
le 22 Nov 2016
Modifié(e) : Image Analyst
le 4 Avr 2020
rsnandi
le 2 Août 2018
Modifié(e) : Image Analyst
le 4 Avr 2020
I'm also getting the same error.
Hamidreza Heydarian
le 9 Jan 2019
Modifié(e) : Image Analyst
le 4 Avr 2020
Same here. This should be a bug.
XiXi Liu
le 4 Avr 2020
通过命令: which -all princomp 或者 which -all pca
查看pca/princomp都有哪些路径;
会显示至少两个有该函数的路径,因此造成冲突;
手动删除其中的某个路径,尽量保留Matlab 工具箱的路径。
Image Analyst
le 4 Avr 2020
princomp() was removed from the Statistics and Machine Learning Toolbox in R2019a.
In r2020a:
load hald
coeff = pca(ingredients)
coeff =
-0.0678 -0.64602 0.56731 0.50618
-0.67852 -0.019993 -0.54397 0.49327
0.029021 0.75531 0.40355 0.51557
0.73087 -0.10848 -0.4684 0.48442
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!