<p>After LDA you have topics characterized as distributions on words. If you plan to compare these probability vectors (weight vectors if you prefer), you can simply use any cosine similarity implemented for Python, <a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html" rel="nofollow noreferrer">sklearn</a> for instance. </p>

<p>However, this approach will only tell you which topics have in general similar probabilities put in the same words.</p>

<p>If you want to measure similarities based on semantic information instead of word occurrences, you may want to use word vectors (as those learned by Word2Vec, GloVe or FastText). </p>

<p>They learned vectors for representing the words as low dimensional vectors, encoding certain semantic information. They're easy to use in <a href="https://rare-technologies.com/word2vec-tutorial/" rel="nofollow noreferrer">Gensim</a>, and the typical approach is loading a pre-trained model, learned in Wikipedia articles or News.</p>

<p>If you have topics defined by words, you can represent these words as vectors and obtain an average of the cosine similarities between the words in two topics (we did it for a <a href="http://jesusfbes.es/wp-content/uploads/2017/09/Roca2017Workshop.pdf" rel="nofollow noreferrer">workshop</a>). There are some sources using these Word Vectors (also called Word Embeddings) to represent somehow topics or documents. For instance, <a href="https://arxiv.org/pdf/1605.02019.pdf" rel="nofollow noreferrer">this</a> one. </p>

<p>There are some recent publications combining Topic Models and Word Embeddings, you can look for them if you're interested. </p>
Calculating the similarity between two vectors
<p>I did LDA over a corpus of documents with topic_number=5. As a result, I have five vectors of words, each word associates with a weight or degree of importance, like this:</p>
<pre><code>Topic_A = {(word_A1,weight_A1), (word_A2, weight_A2), ... ,(word_Ak, weight_Ak)}
Topic_B = {(word_B1,weight_B1), (word_B2, weight_B2), ... ,(word_Bk, weight_Bk)}
.
.
Topic_E = {(word_E1,weight_E1), (word_E2, weight_E2), ... ,(word_Ek, weight_Ek)}
</code></pre>
<p>Some of the words are common between documents. Now, I want to know, how I can calculate the similarity between these vectors. I can calculate cosine similarity (and other similarity measures) by programming from scratch, but I was thinking, there might be an easier way to do it. Any help would be appreciated. Thank you in advance for spending time on this.</p>
<blockquote>
<ul>
<li><p>I am programming with Python 3.6 and gensim library (but I am open to any other library)</p>
</li>
<li><p>I know someone else has asked similar question (<a href="https://stackoverflow.com/questions/48115965/cosine-similarity-and-lda-topics">Cosine Similarity and LDA topics</a>) but becasue he didn't get the answer, I ask it again</p>
</li>
</ul>
</blockquote>