covartech / PRT

Pattern Recognition Toolbox for MATLAB
http://covartech.github.io/
MIT License
145 stars 70 forks source link

PCA #36

Closed anaritam closed 9 years ago

anaritam commented 9 years ago

Hi after using dataSet = prtDataSetClass(features,labels);

dataSet = setClassNames(dataSet,[{'Rest'} {'Index Extension'} {'Fourth Finger Extension'}]); dataSet = setFeatureNames(dataSet,[{'IEMG'} {'MAV'} {'SSI'} {'VAR'} {'RMS'} {'WAMP'} {'MDF'} {'MNF'}]);

pca = prtPreProcPca;
pca = pca.train(dataSet); dataSetNew = pca.run(dataSet);

How can I know, which features from the dataSet did the algorithm chose?

As you can see, I have a dataSet with 3 classes and 8 features

Thanks

kennethmorton commented 9 years ago

PCA does not select variables but instead combines them linearly. The weights that are learned by PCA are stored in the property "pcaVectors"

pca.pcaVectors will be and dataSet.nFeatures by pca.nComponents matrix. Each column contains the feature weights that are used to for each resulting PCA component dimension.

anaritam commented 9 years ago

So, it uses all the features and "weights" them in the best possible way?

kennethmorton commented 9 years ago

PCA determines the weights that will maximize the variance in the projection. http://en.wikipedia.org/wiki/Principal_component_analysis