0
$\begingroup$

I have a trained lda model.now i want to find the new unseen document similarity with the corpus.

model = LdaModel.load(self.LDA_MODEL_FILE)
dictionary = corpora.Dictionary.load(self.DICTIONARY_FILE)
corpus =corpora.MmCorpus(self.LDA_CORPUS_FILE)
bow_corpus_new = [dictionary.doc2bow(doc) for doc in new_documents]
doc_lda = model[bow_corpus_new]
index = similarities.MatrixSimilarity(model[corpus])
index.save(self.index_file)
sims = index[doc_lda]
sims = sorted(enumerate(sims), key=lambda item: -item[1])
print(sims)

By using this method i only get similarity of a document which is in corpus. for a new document i dont get a single value.Any help will be appreciated if any one can guide me how i can do this.why i am not getting any value for a new document?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.