stats.py 文件源码

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

项目:siHMM 作者: Ardavans 项目源码 文件源码
def sample_crp_tablecounts(concentration,customers,colweights):
    m = np.zeros_like(customers)
    tot = customers.sum()
    randseq = np.random.random(tot)

    starts = np.empty_like(customers)
    starts[0,0] = 0
    starts.flat[1:] = np.cumsum(np.ravel(customers)[:customers.size-1])

    for (i,j), n in np.ndenumerate(customers):
        w = colweights[j]
        for k in xrange(n):
            m[i,j] += randseq[starts[i,j]+k] \
                    < (concentration * w) / (k + concentration * w)

    return m

### Entropy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号