suppose I have labeled data and unlabeled data, should I do a PCA process on all the data, and then feed the labeled data through a classifier? Or take only the labeled data through the PCA process and then to the classifier?


Adding t-SNE plot of my data (blue and red are labeled and green is unlabeled) enter image description here


  1. Goal is to Binary classify the green data (which is unknown) to red or blue (blue is 1, red is 0)

  2. t-SNE helps me by giving a picture of how my data spread on a 2D dimension.

  3. I hypothesis PCA will help me reduce/compress my data and help me get a better representation of the data (as I only have 4K rows of data and originally, 51 features).

  4. Having labeled and un-labeled data doesn't prevent me from solving the problem, but I want to take every advantage I can in order to get a better classification.

  • 2
    $\begingroup$ What is your goal? What problem are you trying to solve? How does PCA or $t$-SNE help you solve the problem? How does having labeled and un-labeled data prevent you from solving the problem? $\endgroup$
    – Sycorax
    Aug 28, 2018 at 17:23
  • $\begingroup$ @Sycorax Agreed. Also, why PCA and not cluster analysis? $\endgroup$
    – Carl
    Sep 9, 2018 at 14:10

1 Answer 1


If the labeled and unlabeled data are from the same distribution (i.e. generated by the same process) then you should use both for training PCA, as you'll get a better estimate of the covariance matrix. But, if using PCA for dimensionality reduction, keep in mind that it's unsupervised. So, the directions of greatest variance in the input may or may not coincide with the most informative directions for your classification problem.

  • $\begingroup$ When mapping my data with t-SNE, the first issue you describe is what I see in the map.. I guess It would be smarter to use PCA on the whole dataset for that reason.. (reason is unlabeled data does fall together with my labeled data). I'll attach my t-SNE for you to support this claim if you think its true. $\endgroup$
    – Eran Moshe
    Aug 28, 2018 at 9:30

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.