gregversteeg / corex_topic

Hierarchical unsupervised and semi-supervised topic models for sparse count data with CorEx
Apache License 2.0
626 stars 119 forks source link

Dimension mismatch error #30

Closed sidgitind closed 4 years ago

sidgitind commented 4 years ago

Hi, I have trained the corextopic model and trying to predict the topic for a text document. My code for prediction is given below

with open('textdata.txt', 'r') as file:
    text_data = file.read().replace('\n', ' ')
doc_word1 = vectorizer.transform([text_data])
doc_word1 = ss.csr_matrix(doc_word1)

anchored_topic_model.predict(doc_word1)

and the snipper from error log is

--> 517                 raise ValueError('dimension mismatch')
    518 
    519             result = self._mul_multivector(np.asarray(other))

ValueError: dimension mismatch

Can somebody help in this? Thanks

sidgitind commented 4 years ago

Have pointed out the error as comments in other issue. So closing this.