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?


1 Answer 1


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.

  • $\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
    Commented Mar 4, 2018 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$ Commented Mar 5, 2018 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.