0
$\begingroup$

I used PCA function in MATLAB to decrease features on my data set.

By this code I can reduce features from 12 to 8(as an example). It works good but my question is that how can I found with feature have been removed or which feature are selected on the result?

[~, pca_scores, ~, ~, var_explained] = pca(myDataSet, 'NumComponents', 8);
$\endgroup$
3
$\begingroup$

PCA doesn't remove any specific feature.

What PCA does it to calculate linear combinations of your variables in such way that they get "summarized" in fewer variables.

You don't eliminate variables, you reexpress them.

$\endgroup$
5
  • $\begingroup$ Then how to converts (or remove some columns==features) columns from 12 to 8? then what is this means on the result (pca_scores)? $\endgroup$ – motevalizadeh Apr 23 '19 at 20:53
  • $\begingroup$ [Coeff, SCORE, LATENT, TSQUARED, EXPLAINED] = pca(myDataSet, 'NumComponents', 8); The Coeff matrix tells you how to convert 12 to 8, the first component is: $Coeff(1,1)*myDataSet(:,1) + Coeff(2,1)*myDataSet(:,2) + Coeff(3,1)*myDataSet(:,3) + Coeff(4,1)*myDataSet(:,4) + ... + Coeff(12,1) * myDataSet(:,12)$ and so on... $\endgroup$ – Juan Esteban de la Calle Apr 23 '19 at 20:59
  • $\begingroup$ @motevalizadeh PCA primarily does (linear) feature extraction not feature selection, e.g. 1st feature from those 8 features could be the average of all 12 original features! If you want to use PCA for feature selection, please take a look at this post on stats. $\endgroup$ – Esmailian Apr 23 '19 at 21:03
  • $\begingroup$ @JuanEstebandelaCalle As an example on my data set rows , column1=age, column2=skin color, column3=tall, column4=weight and... (12 columns). Now if I use pca 12 columns will convert to 8 columns, just want to know tall has been removed? age has been removed or what? $\endgroup$ – motevalizadeh Apr 23 '19 at 21:08
  • 1
    $\begingroup$ None, as you can see in the formula, any of the components INCLUDE all the columns in your database. $\endgroup$ – Juan Esteban de la Calle Apr 23 '19 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.