0
$\begingroup$

I realize some questions have been asked already about one-hot encoding for PCA. The answer seems to be along the lines of 'The PCA will run, but does not necessarily make sense.'

However, I have a question regarding the application of PCA on one-hot encoded sequence data. For example, in this paper, the authors claim to first one-hot encode DNA sequences, and then apply PCA on some resulting matrix. I'm trying to understand this paper (I'm looking to apply a similar strategy for a different kind of sequence), but I don't see to what matrix they actually apply PCA.

The part I don't understand is this: If we one-hot encode using the categories "$a,t,g,c,\_$" (as stated in the paper)

a sequence $\{gaatc\}$ becomes: $\begin{bmatrix} 0 & 1 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 \\ \end{bmatrix}$

a sequence $\{aagctt\}$ becomes: $\begin{bmatrix} 1 & 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0\\ \end{bmatrix}$

Meaning every sample is now a matrix. In "normal" PCA every sample is a vector, which we stack together into the matrix of which we determine the coveriance, etc.

So what is being done in case of one-hot encoded sequence data? How are these sample-matrices combined such that we can determine a (useful) covariance matrix?

$\endgroup$

1 Answer 1

0
$\begingroup$

The paper is incorrect in applying Principal Component Analysis (PCA) to boolean data since PCA implicitly minimizes a squared loss function, which is not always appropriate for not real-valued data. "A Generalization of Principal Components Analysis to the Exponential Family" by Collins et al. goes into detail.

Boolean data would be more appropriately modeled with Multiple Correspondence Analysis (MCA).

$\endgroup$
3
  • $\begingroup$ I understand that PCA may not be appropriate for categorical data. However, I am interested in seeing what they actually (mathematically) do here. The results they claim seem at least interesting, if not useful. $\endgroup$
    – Chris_abc
    May 9 at 7:16
  • $\begingroup$ Your question may be better answered on stats.stackexchange.com. datascience.stackexchange.com tends to focus on correctly applying the most appropriate technique. $\endgroup$ May 9 at 14:34
  • $\begingroup$ IMO you jump too quickly to "not appropriate", without understanding what the authors are doing. $\endgroup$
    – Chris_abc
    May 9 at 14:44

Your Answer

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

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