visualizations.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:tRECS 作者: TeeOhh 项目源码 文件源码
def make_lda(self, nt, iterations):
        # '''
        #   description: sets important attributes and creates lda model
        #   params:     nt-number of topics for lda
        #               iterations: number of iterations for lda
        #               dim: 2d or 3d grpah
        #               threshold: minimum percentage of the maximum topic in a document which can be included in a "cluster"
        # '''

        self.nt = nt        


        self.cvectorizer = CountVectorizer(min_df=5, stop_words='english')
        cvz = self.cvectorizer.fit_transform(self.descriptions)

        # train an LDA model
        self.lda_model = lda.LDA(n_topics=nt, n_iter=iterations)
        self.X_topics_original = self.lda_model.fit_transform(cvz)

        #initialize current stuff
        self.X_topics_current = self.X_topics_original
        self.titles_current = self.titles_original
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号