How to find relative loading factors on the primary principal component?
2 次查看(过去 30 天)
显示 更早的评论
I have a set of color images sized 600*600.I extracted 16 color channels from each image and changed each channel into column matrix sized 360000*1 and concatenated each 16 channels to form 360000*16 matrix.Now I want to implement PCA on it to identify the most discriminative channel.Implemented code is given below:
Xi=[Rcol,Gcol,Bcol,Hcol,Scol,Vcol,Ycol,Icol,Qcol,L1col,acol,bcol,M1col,M21col,M3col,M61col];
avg=mean(Xi);
sd=std(Xi,0,1);
Xnorm=bsxfun(@minus,Xi,avg);
Xnorm = bsxfun(@rdivide,Xnorm,sd);
Xi1=cov(Xnorm);
[V, D]=eig(Xi1);
In implementing paper they say to analyze the relative loading factor of different color channels on the primary principal component.So can you tell me how to calculate loading factor on primary principal component using matlab?
0 个评论
回答(1 个)
Vatsal
2024-6-13
Hi,
The loading factors are the coefficients of the principal components, indicating the contribution of each variable to that principal component. Given that you have computed the eigenvectors (V) and eigenvalues (D) from the covariance matrix of the normalized data, the next steps involve identifying the primary principal component and extracting its loadings.The primary principal component is associated with the largest eigenvalue. Since MATLAB returns the eigenvalues in ascending order in 'D', the last column of 'V' corresponds to the primary principal component.The eigenvector associated with the largest eigenvalue (i.e., the primary principal component) contains the loadings for each variable on this component.
Here is the implementation:
% Assuming V and D are already computed as per your code
% Find the index of the largest eigenvalue
[~, largestEigIndex] = max(diag(D));
% Extract the eigenvector (loadings) corresponding to the largest eigenvalue
primaryPC = V(:, largestEigIndex);
% Display the loadings
disp('Loadings on the primary principal component:');
disp(primaryPC);
I hope this helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!