使用Scikit-learn TfIdf和Gensim LDA

9

我曾在scikit learn中使用过各种版本的TFIDF来建模一些文本数据。

vectorizer = TfidfVectorizer(min_df=1,stop_words='english')

生成的数据X格式如下所示:
<rowsxcolumns sparse matrix of type '<type 'numpy.float64'>'
    with xyz stored elements in Compressed Sparse Row format>

我想尝试使用LDA方法来降低我的稀疏矩阵的维度。 有没有简单的方法将NumPy稀疏矩阵X导入gensim的LDA模型中?

lda = models.ldamodel.LdaModel(corpus=corpus, id2word=dictionary, num_topics=100)

我可以忽略scikit,按照gensim教程的方式进行,但我喜欢scikit向量化器的简单性和所有参数。

1个回答

11

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接