How do you initialize a gensim corpus variable with a csr_matrix?

后端 未结 1 365
梦谈多话
梦谈多话 2020-12-30 13:17

I have X as a csr_matrix that I obtained using scikit\'s tfidf vectorizer, and y which is an array

My plan is to create features using LDA, however, I failed to find

相关标签:
1条回答
  • 2020-12-30 14:12

    Gensim has a semi-well-hidden function that can kind of do this for you:

    http://radimrehurek.com/gensim/matutils.html#gensim.matutils.Sparse2Corpus

    "class gensim.matutils.Sparse2Corpus(sparse, documents_columns=True) Convert a matrix in scipy.sparse format into a streaming gensim corpus."

    I've had some success with it using a corpus extracted with CountVectorizer, then loaded into gensim.

    0 讨论(0)
提交回复
热议问题