Please provide in depth details on PCA MATLAB function
1 view (last 30 days)
Show older comments
Ashwini Amin
on 9 Sep 2019
Commented: Ashwini Amin
on 13 Sep 2019
Hello Team,
I have a Cancer and Benign Dataset that does not cluster using the peak value feature extracted from the signals as shown in the figure below.
But after performing the PCA both the groups are seperating out well. Could you please please provide the reason behind this on how does PCA function in matlab actually calculates the values.
I have gone through the PCA function but not getting more insight on how the correlated data gets sepearted using PCA
Before PCA
![matlab.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237536/matlab.jpeg)
After PCA
![matlabpca.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237537/matlabpca.png)
0 Comments
Accepted Answer
Neuropragmatist
on 10 Sep 2019
How many features do you give the PCA when you give it the dataset? Just the XY values you plotted in the first graph? Or do you also give it some other measurements? Do you give it the group identity (i.e the blue/orange colours)?
Maybe you could also show us the code you used to get the above result.
NP.
3 Comments
Neuropragmatist
on 12 Sep 2019
OK, so I have multiple points/questions:
1) Because you give multiple variables to pca, there is no real way to know what the resulting principal components represent (because the represent a multivariate combination of variables). So asking why PCA clusters your two datasets in the way that it does is not really easy to answer. Usually we use PCA to find novel ways to cluster the data through dimensionality reduction, not find ways to cluster the data based on already existing dimensions.
2) This makes me wonder what your goal is here overall? What are you trying to get from the PCA?
3) You are running PCA on your cancer and normal groups seperately, but then plotting the results in one graph. That doesn't make a lot of sense to me (but I'm willing to be corrected) because the principal components found for one group may, and probably will be completely unrelated to the other group. i.e. maybe feature 1 explains the greatest variance in the cancer dataset but feature 5 explains the most in the normal data set. In which case the axes of your graph will not make 1 lick of sense.
4) Related to this, what are you plotting in your first graph? Do you expect some relationship between those variables and the PCA results? Because that won't be the case.
5) I really don't mean this in a derisory way, but maybe you need to understand the basics of PCA before embarking on this analysis. Perhaps you should consult someone who has either done what you are trying to do already or who knows PCA very well.
NP.
More Answers (0)
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!