gDirichlet.py 文件源码

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

项目:PyBGMM 作者: junlulocky 项目源码 文件源码
def rvs(self, size=1):
        res = np.zeros(shape=(size, self._K))
        for i in range(size):
            alpha = np.array([random.gammavariate(self._a, 1. / self._b) for local in range(self._K)])
            try:
                res[i,:] = np.random.dirichlet(alpha, 1)
            except:
                res[i, :] = res[i-1,:]
            # res[i, :] = np.array([random.gammavariate(local, 1) for local in alpha])

        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号