# How to find "similar documents" after a Latent Dirichlet Allocation model is built

Let's say I run an LDA model with 3 topics on 5 documents.

After the model is learned (with Gibbs sampling presumably), I have topic distribution for each document, shown as the following: My question is, how do I retrieve document(s) that are "most similar to document-1" ?

In clustering algorithms such as K-means, each document is assigned to one of the K classes. To retrieve doc-1's neighbor documents, I just need to find all the documents that get assigned to the same cluster as doc-1.

What procedure should I do with LDA model?

• If you have per document "topic" proportions, you could use a measure to compare discrete distributions like Earth Mover's Distance. Mar 29 '17 at 22:08
• Is your question about how to calculate the difference between probability distributions? (@kedarps's answer) Or generally how to compute similarity between documents? Because as I understand it, you can use your distance metric of choice with the topic proportions. See this answer.
– Ben
Jul 25 '17 at 20:56

I found the metrics below to be quite useful. Use these metrics to compare document 1 ($P$ distribution on Wikipedia) to document $i$ ($Q$ distribution on Wikipedia). Repeat this for all documents (iterate through $i$ and replace $Q$ each time) to create a list of distances. Then rank the distances from smallest to biggest - the smallest one will be the most similar to doc-1