I'm building an NLP question-answering application using Doc2Vec technique in gensim package of Python. My training questions is very small, only 20 documents and I am getting very inaccurate and different similarities even for same document while running at multiple instances. Almost all the sources which I referred trained data set containing thousands of documents. So I infer the reason behind my model's inaccuracy is the size of my data set.

Is there any way to improve the similarity between documents, maybe by changing parameters or feature engineering? If yes, what are those parameters and by what ratio should I change them? If no, what are other ways or perhaps other neural network models to tackle the problem?

  • 2
    $\begingroup$ Try using pretrained embeddings. $\endgroup$
    – Emre
    Jun 28, 2017 at 5:30
  • $\begingroup$ a dataset of 20 documents is never going to work in any machine learning scenario. So, however you tweak the parameters, it will not work. as @Emre suggested go with pretrained ones or train a standard huge dataset and retrain the model further with those 20 docs you have. $\endgroup$
    – chmodsss
    Jul 28, 2017 at 13:27
  • 1
    $\begingroup$ Thanks a lot. I have created my own training set with 700+ questions and training it over GoogleNewsVector. It gives excellent results without having to tweak any parameters. $\endgroup$
    – Kshitiz
    Jul 28, 2017 at 18:02
  • 1
    $\begingroup$ @ahamsiva what if each of the docs is a few GBs big? It's a mistake to think that small # docs implies small number of examples $\endgroup$
    – gokul_uf
    Jul 28, 2017 at 23:47
  • 1
    $\begingroup$ @gokul_uf Thats true. But 20 documents mean 20 samples, however big it maybe. and only with the number of samples a ML algorithm could learn, doesnt matter how huge each sample is. how about training set of 10 cat pictures and 10 dog pictures with 4k resolution or 100000 cat and dog pictures with 240p resolution. you know what will work right. $\endgroup$
    – chmodsss
    Jul 30, 2017 at 20:09

1 Answer 1


20 is a very very small number, even performing the following might not help. However, you can try changing the parameters such as the window size, and the number of iterations. However, increasing the number of iterations a lot can cause the model to over fit. In my case, decreasing the window size helped.


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.