I have 100 sentences that I want to cluster based on similarity. I've used doc2vec to vectorize the sentences into 20 dimensional vectors and applied kmeans to cluster them. I haven't got the desired results yet.

I've read that doc2vec performs well only on large datasets. I want to know if increasing the length of each data sample, would compensate for the low number of samples, and help the model train better?

For example, if my sentences are originally "making coffee", "making tea", "playing with dogs", would changing them to "making coffee requires a cup of milk and some coffee powder", "making tea requires boiling water and some tea leaves" (supplement each document with more information) help in getting better results? Would the model understand the context better?


1 Answer 1


Increasing the sentence length might help, but not much. You can try n-grams(2 or 3) while vectorizing the data. Generally more number of sentences will help.

  • $\begingroup$ Can you explain why you think sentence length might not help much? $\endgroup$ Aug 27, 2019 at 5:05
  • $\begingroup$ "making coffee requires a cup of milk and some coffee powder", "making tea requires boiling water and some tea leaves" if you are adding like this it might help a bit, given you can do this way for all 100 sentences. But if you are adding grammar to the sentence rather than increasing context. grammar would be similar to other sentences, so it doesn't make much difference. $\endgroup$ Aug 27, 2019 at 5:29
  • $\begingroup$ Right. I understood your point about grammar - it doesn't add context to the sentence and wouldn't help. $\endgroup$ Aug 27, 2019 at 5:45
  • $\begingroup$ I was thinking, and correct me if I'm wrong, making the sentences longer by adding more info may also worsen the performance - mostly because each document is going to be more widely different from the others ("making tea" and "making coffee" were somewhat similar, but "making tea requires green tea leaves, boiling water and a washed cup" and "making coffee requires milk, coffee powder and a washed cup" are more dissimilar than similar because the vocab in each sentence is different) $\endgroup$ Aug 27, 2019 at 5:47
  • $\begingroup$ yes, exactly. i didn't get what kinda of clustering you are trying to achieve. $\endgroup$ Aug 27, 2019 at 6:47

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.