1
$\begingroup$

Short question:

As stated in the title, I'm interested in the differences between applying KMeans over PCA-ed vectors and applying PCA over KMean-ed vectors.

Long question:

Let's suppose we have a word embeddings dataset. Each word in the dataset is embeded in R300.

We want to perform an exploratory analysis of the dataset and for that we decide to apply KMeans, in order to group the words in 10 clusters (number of clusters arbitrarily chosen).

After doing the process, we want to visualize the results in R3. We could tackle this problem with two strategies;

Strategy 1 - Perform KMeans over R300 vectors and PCA until R3:

  1. Apply KMeans to the R300 embeddings.
  2. Perform PCA to the R300 embeddings and get R3 vectors.
  3. Plot the R3 vectors according to the clusters obtained via KMeans

Result: http://kmeanspca.000webhostapp.com/KMeans_PCA_R3.html

Strategy 2 - Perform PCA over R300 until R3 and then KMeans:

  1. Perform PCA to the R300 embeddings and get R3 vectors.
  2. Apply KMeans to the R3 embeddings.
  3. Plot the R3 vectors according to the clusters obtained via KMeans

Result: http://kmeanspca.000webhostapp.com/PCA_KMeans_R3.html

Are there any differences in the obtained results? Any interpretation?

In case both strategies are in fact the same. Why is that?

$\endgroup$
  • $\begingroup$ The title is a bit misleading. You don't apply PCA "over" KMeans, because PCA does not use the k-means labels. $\endgroup$ – Anony-Mousse Oct 23 '18 at 20:57
  • $\begingroup$ Also: which version of PCA, with standardization before, or not, with scaling, or rotation only? $\endgroup$ – Anony-Mousse Oct 23 '18 at 21:29
  • $\begingroup$ With any scaling, I am fairly certain the results can be completely different once you have certain correlations in the data, while on you data with Gaussians you may not notice any difference. $\endgroup$ – Anony-Mousse Oct 23 '18 at 21:33
1
$\begingroup$

There is a difference. In your first strategy, the projection to the 3-dimensional space does not ensure that the clusters are not overlapping (whereas it does if you perform the projection first).

This is because some clusters are separate, but their separation surface is somehow orthogonal (or close to be) to the PCA.

If you increase the number of PCA, or decrease the number of clusters, the differences between both approaches should probably become negligible.

$\endgroup$
1
$\begingroup$

I would recommend applying GloVe info available here: Stanford Uni Glove to your word structures before modelling.

This way you can extract meaningful probability densities. If you then PCA to reduce dimensions at least you have interrelated context that explains interaction.

Effectively you will have better results as the dense vectors are more representative in terms of correlation and their relationship with each other words is determined. This is due to the dense vector being a represented form of interaction. This process will allow you to reduce dimensions with a pca in a meaningful way ;)

$\endgroup$
  • $\begingroup$ If you have "meaningful" probability densities and apply PCA, they are most likely not meaningful afterwards (more precisely, not a probability density anymore). $\endgroup$ – Anony-Mousse Oct 23 '18 at 21:30

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.