Clear Filters
Clear Filters

How to find relative loading factors on the primary principal component?

2 views (last 30 days)
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?

Answers (1)

Vatsal
Vatsal on 13 Jun 2024
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!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!