フィルターのクリア

pca() not working as advertised

2 ビュー (過去 30 日間)
Alexander Tarroni
Alexander Tarroni 2016 年 11 月 22 日
コメント済み: Image Analyst 2020 年 4 月 4 日
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

回答 (1 件)

KSSV
KSSV 2016 年 11 月 22 日
Try
[pc,score,latent,tsquare] = princomp(ingredients);
  5 件のコメント
XiXi Liu
XiXi Liu 2020 年 4 月 4 日
通过命令: which -all princomp 或者 which -all pca
查看pca/princomp都有哪些路径;
会显示至少两个有该函数的路径,因此造成冲突;
手动删除其中的某个路径,尽量保留Matlab 工具箱的路径。
Image Analyst
Image Analyst 2020 年 4 月 4 日
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

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

カテゴリ

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