2
$\begingroup$

I have a dataset with both continuous and categorical features. I want to reduce the dimensionality, but cannot apply PCA directly on the dataset because of the categorical features.

One solution I thought of was to run PCA exclusively on the continuous features, reduce the dimensions there, and then add the categorical features as they are to the reduced table with the continuous features.

I have not seen this method anywhere, but it makes sense to me, so I was wondering if it's OK.

$\endgroup$
3
  • 1
    $\begingroup$ that really depends on what type of data/problem you have $\endgroup$
    – redress
    Jun 14, 2017 at 18:36
  • $\begingroup$ @redress can you please elaborate. Right now, I just want to reduce features. What I'm suggesting is that all categorical features stay, but at least I can reduce the number of continuous features, even if they lose their interpretability. $\endgroup$
    – lhay86
    Jun 14, 2017 at 19:13
  • 1
    $\begingroup$ how many different classes exist in each category? what is the actual complexity of the categorical data? $\endgroup$
    – redress
    Jun 14, 2017 at 19:40

1 Answer 1

-1
$\begingroup$

You can binaries your categorical features. Try to google and learn about One-of-k coding. That way you end up with only numerical data.

And if you do that I will suggest that you standardize your numerical features.

$\endgroup$
3
  • $\begingroup$ stats.stackexchange.com/questions/5774/… My way is being criticized here. Worth a read $\endgroup$
    – k.dkhk
    Jun 14, 2017 at 18:45
  • 1
    $\begingroup$ Even if I binarize categorical features, I will end up with discrete binary features (which, while numerical, are not continuous and therefore not naturally used in PCA) $\endgroup$
    – lhay86
    Jun 14, 2017 at 19:11
  • 1
    $\begingroup$ Could you state a reference of PCA requiring continuous data? $\endgroup$
    – Michael M
    Jun 14, 2017 at 20:27

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