topic_models.py 文件源码

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

项目:slda 作者: Savvysherpa 项目源码 文件源码
def _create_lookups(self, X):
        """
        Create document and term lookups for all tokens.
        """
        docs, terms = np.nonzero(X)
        if issparse(X):
            x = np.array(X[docs, terms])[0]
        else:
            x = X[docs, terms]
        doc_lookup = np.ascontiguousarray(np.repeat(docs, x), dtype=np.intc)
        term_lookup = np.ascontiguousarray(np.repeat(terms, x), dtype=np.intc)
        return doc_lookup, term_lookup
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号