Prannoy Mittal
Prannoy Mittal

Reputation: 1575

Building Vector for a sentence in doc2vec from an untrained data set

I have a doc2vec model build from my data, now I have a new sentence in run time which does not belong to the trained data set.

How can I build or predict a vector for this sentence from my model?

How should I handle unknown words in this sentence?

Upvotes: 2

Views: 1676

Answers (1)

kampta
kampta

Reputation: 4898

Gensim (development version) seems to have a method to infer vectors of new sentences. Check out model.infer_vector(NewDocument) method in https://github.com/gojomo/gensim/blob/develop/gensim/models/doc2vec.py

Upvotes: 4

Related Questions