CoEmbedding.py 文件源码

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

项目:2in1 作者: XunGuangxu 项目源码 文件源码
def _solve_theta(lo, hi, topic, X, BTBpR, c0, c1, f):
    theta_batch = np.empty((hi - lo, f), dtype=topic.dtype)
    for ib, u in enumerate(range(lo, hi)):
        x_u, idx_u = get_row(X, u)
        B_u = topic[idx_u]
        a = x_u.dot(c1 * B_u)
        '''
        non-zero elements handled in this loop
        '''
        B = BTBpR + B_u.T.dot((c1 - c0) * B_u)#B_u only contains vectors corresponding to non-zero doc-word occurence
        theta_batch[ib] = LA.solve(B, a)
    theta_batch = theta_batch.clip(0)
    return theta_batch
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号