7
$\begingroup$

I have a really large data set with mixed variables. I have converted categorical variables to numerical using OneHotEncoding and it has resulted in more than a couple of thousand different features, combined that is.

Is it possible to apply dimensionality reduction algorithms on OneHotEncoded data which looks like [[1. 0. 1. 0.]...[0. 0. 0. 0.]] or should it be done by merging with the original data set?

$\endgroup$
  • 1
    $\begingroup$ By the way: Have you performed your one-hot encoding with pd.get_dummies from the pandas package with drop_first=True? That saves you one column per categorical feature without removing any information. $\endgroup$ – Elias Strehle Feb 19 '18 at 14:58
  • $\begingroup$ No @EliasStrehle I haven't. I must try that. Thanks for the tip. $\endgroup$ – moirK Feb 20 '18 at 17:33
5
$\begingroup$

Following your example, you have different points in a 4-dimensional space. So, yes! you can use any dimensionality reduction technique, from PCA to UMAP.

In general, if your data is in a numeric format (and one-hot actually is), all the elements have the same dimensionality, and you don't have undefined values (NAN, inf), you can always use dimensionality reduction.

| improve this answer | |
$\endgroup$
0
$\begingroup$

It is definitely not a good idea to do PCA to one hot encoded variables, at the end PCA algorithm calculates eigenvalues for you dataTdata matrix so if you do it for one hot encoded variables you will lose the information from less important variables instead of being aggregating it on one of your principal components

| improve this answer | |
$\endgroup$

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.