lda.py 文件源码

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

项目:KATE 作者: hugochan 项目源码 文件源码
def calc_pairwise_dev(model):
    # the average squared deviation from 0 (90 degree)
    n = model.num_topics
    weights = model.state.get_lambda()
    weights = np.apply_along_axis(lambda x: x / x.sum(), 1, weights) # get dist.
    weights = unitmatrix(weights) # normalize
    score = 0.
    for i in range(n):
        for j in range(i + 1, n):
            score += (weights[i].dot(weights[j]))**2

    return np.sqrt(2. * score / n / (n - 1))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号