필터 지우기
필터 지우기

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 CenterFile Exchange에서 Dimensionality 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