I have a question related to K-Means clustering and PCA. In my project, I have two target classes - 0 and 1- and I am trying to group the records that were predicted as 0 into 5 clusters. I am using PCA strictly as a visualization technique since my data frame has 8 dimensions and I need to bring it down to 2-3 dimensions to see the clusters. My question is about the procedure I should follow~
First Way:
- Extract all records with target = 0
- Do PCA and KMeans on just those records
Second way:
- Do PCA on all records (target = 0 and 1)
- Extract PCA records with target = 0 (from the PCA data frame created in step 1)
- Do KMeans on those records
The PCA1, PCA2, PCA3 values for the records(with target = 0) are different using these two ways. And since the PCA values are different, the cluster visualizations are also showing up differently. Which option should I follow?
Thank you so much!