필터 지우기
필터 지우기

I used PCA on 9-D data. I want to plot PCs direction

조회 수: 1 (최근 30일)
farshad jahangiri
farshad jahangiri 2022년 9월 28일
답변: the cyclist 2022년 9월 29일
Hi , I extract 2 PC and know I want to plot direction of PCs but I don't know how.
I attached data and code
clc;
clear;
data=importdata('data.txt');
n_data=zscore(data);
[coeff,scores,latent] = pca(n_data,'Algorithm','eig');
p=scatter(scores(:,1),scores(:,2),'filled')
p =
Scatter with properties: Marker: 'o' MarkerEdgeColor: 'none' MarkerFaceColor: 'flat' LineWidth: 0.5000 XData: [-2.6987 -2.9086 -2.6022 -2.7088 -2.5972 -2.6443 -2.4184 -2.6105 -2.6442 -2.6342 -2.7498 -2.8929 -3.0329 -2.9947 -2.7199 -2.6996 -2.6480 -2.6630 -2.5890 -2.4588 -2.3512 -2.6149 -2.6046 -2.6306 -2.7813 -2.9008 -2.8532 -2.5646 … ] YData: [-1.1820 -0.3770 -1.9835 -1.6290 -1.4321 -0.6428 -1.4788 -1.7337 -1.9207 -2.0610 -2.2508 -1.8076 0.1766 -0.5802 -1.0807 -1.6126 -1.1661 -1.0277 -2.4950 -1.5415 -1.4948 -1.3786 -0.6466 0.3495 0.0197 -0.0436 0.5450 0.6005 0.2341 … ] SizeData: 36 CData: [0 0.4470 0.7410] Show all properties
xlabel('Principal Component 1');
ylabel('Principal Component 2');
  댓글 수: 3
the cyclist
the cyclist 2022년 9월 28일
I am confused by what you mean by "direction of PCs".
Because you are plotting the scores variable, you are plotting in principal component space (not the original coordinate space). I would say that the x- and y- axes are the "direction of the PCs" in this plot. (The other 7 PCs are orthogonal to these.)
If this does not make sense, or does not capture what you mean, maybe you could explain some more. What are you trying to illustrate?
farshad jahangiri
farshad jahangiri 2022년 9월 29일
이동: the cyclist 2022년 9월 29일
@the cyclist Hi . I am confused about this. in some researches like this picture they showed direction of principal components. I want to show when covariance matrix changes, the PCs direction will be change.
I think we just can show this direction in not transformed data and in original axis, not transformed data (scores).
In this case How can I show the direction of PCs in original data and what data should be used instead of scores? I am confused because the scores have all 9 dimensions and can be shown in one dimension, but the original data cannot

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2022년 9월 29일
Your comment was helpful. I think the biplot function may do what you need.
The biplot illustrates what the original axes look like in (two or three dimensions of) PC space.
I think that making a biplot of the inverse of coeff would illustrate what the PC vectors look like in the original space. (I am not certain of this last statement. I'd need to think about it more, and experiment a bit.)

추가 답변 (0개)

카테고리

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