I have documents, and I calculated the word vectors using word2vec for all the terms in my corpus.

Now I want to compute similarity between documents using the bag-of-words model. After creating the Bag-of-words ( consisting of vector representations).

how do I now compute similarity between a sequence of vectors?

Do I simply just take the mean? and calculate the cosine similarity between the mean vectors?

or is there a better approach for computing similarity between two bags?


BoW is a text representation like word2vec or doc 2vec. If you already have the word2vec vectors then you can take the mean for each document and calculate the similarity but it's not the direct approach. The direct approach is to calculate doc2vec which models the documents directly and with more detailed precision than word2vec.

| improve this answer | |
  • $\begingroup$ with regard to bag of words model, assuming that some words wont be present in one document, how do you deal with them? Do you simpyl ignore them when taking the mean? or do you set there components to zero $\endgroup$ – SFD Mar 4 '18 at 23:18
  • $\begingroup$ Actually BoW sets them to zero. BoW variants are some sparse matrices as not every feature (word,n-grams) are present in every document. $\endgroup$ – Kasra Manshaei Mar 5 '18 at 10:55

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.