MATLAB Answers

Determining the number of principal components

15 views (last 30 days)
Serra Aksoy
Serra Aksoy on 29 Mar 2021
Answered: Mahesh Taparia on 2 Apr 2021
Hi everyone,
I applied svd method to my matrix as a dimensionality reduction method.
My main aim is to get higher classification rate.
%Singular value decomposition of X;
[U, Sig, V]=svd(X);
sv=diag(Sig)
%for the distribution of singular values;
figure;
sv=sv/sum(sv);
stairs(cumsum(sv));
xlabel('singular values');
ylabel('cumulative sum');
So my question here is that how can i determine the number of singular values that i should take for creating a new data for classification?
As i understand from the above figure i have to take approximately 250 singular values that it counts for 95% of my data.
So should I take first 250 singular values for creating a new data for classification? How can i interpret the figure above?
Thanks in advance.

Answers (1)

Mahesh Taparia
Mahesh Taparia on 2 Apr 2021
Hi
The function svd returns the singular values in descending order, so you can consider first N values. Regarding the consideration of number (N) of singular values, it depends upon the application. Usually the singular values are considered with cumulative variance of >90%. So you can experiment with the trained classification model by varying the number of singular values and check the model accuracy. You can select the number of values where the accuracy is converging or the accuracy reached the desired values.
Hope it will help!

Community Treasure Hunt

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

Start Hunting!