0
$\begingroup$

I have a data set with a large amount of features. I'm applying PCA on it in order to run it through K-means, to discover clusters in my data set.

I'd like to know what is the best practice to make predictions on new data points (with many features) on my clusters (which are defined using only two PCs).

Thanks!

$\endgroup$
3
  • 3
    $\begingroup$ You assign to new data points the cluster that is closest to that data point (the closest cluster center to be precise). Not really a best practice, this is just the way the algorithm works. I don't think I understand your question. $\endgroup$
    – Gijs
    Nov 6 '17 at 19:03
  • $\begingroup$ @Gijs why do you say its not a good practice? $\endgroup$ Mar 27 '20 at 15:58
  • $\begingroup$ What I mean is, this is the straightforward approach, the most direct approach. As such, I wouldn't call it a "best practice", implying other alternatives. $\endgroup$
    – Gijs
    Mar 27 '20 at 16:07
1
$\begingroup$
  1. PCA. Save the basis transform, e.g the SKLearn object.
  2. K-Means on reduced dimension
  3. For every new datapoint, run the pca transformation and then find the cluster with the closest distance.

The issue with PCA transformation is that it is dependent on the data you present to it. So don't remake the PCA on the new data, because the embeddings will be different.

$\endgroup$
0
$\begingroup$

You would have to first apply the learned PCA mapping to your new data points, then use your K-means model to predict which cluster(s) the new data belong to, in that order.

$\endgroup$
-1
$\begingroup$

You are probably better off using tSNE instead of PCA before running K-Means as:

tSNE: Reduces dimensions down using a clustering algorithm (Video)

PCA: Reduces dimensions by identifying dominant values

$\endgroup$
1
  • 1
    $\begingroup$ tSNE is purely for visualisation, not for training models on or making predictions on new data points. $\endgroup$
    – PyRsquared
    Feb 7 '18 at 22:13

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.