2
$\begingroup$

I have a mixture of numeric and categorical inputs, the categorical inputs are relatively low cardinality (perhaps 10-15).

I want to use PCA for anomaly detection, but am not sure how best to encode the categorical attributes.

Will one hot encoding work, and if not, what should I try?

$\endgroup$

1 Answer 1

1
$\begingroup$

I would not try pca, but rather correspondence analysis (or some its generalization to mixed categorical/continuous data.) See Can principal component analysis be applied to datasets containing a mix of continuous and categorical variables? for ideas and linkt to generalizations such as homogeneity analysis.

$\endgroup$
1
  • 1
    $\begingroup$ I may support this. Dummy coding of nominal variables in PCA leads essentially to a (Multiple) Correspondence analysis (MCA). Categorical PCA (CATPCA) is a technique which incorporates them both. It allows a mixture of numeric, ordinal, nominal variables and does dimensionality reduction quantifying them optimally. $\endgroup$
    – ttnphns
    Commented Jul 25, 2019 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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