jlda.py 文件源码

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

项目:dmr 作者: mpkato 项目源码 文件源码
def simple_multivariate_t_distribution(self, x, mu, sigma, df, d):
        '''
        Multivariate t-student density:
        output:
            the density of the given element
        input:
            x = parameter (d dimensional numpy array or scalar)
            mu = mean (d dimensional numpy array or scalar)
            Sigma = scale matrix (dxd numpy array)
            df = degrees of freedom
            d: dimension
        '''
        num = special.gamma((df + d)/2)
        xSigma = np.dot((x - mu), np.linalg.inv(sigma))
        xSigma = np.array([xSigma[i, i] for i in range(self.K)])
        denom = special.gamma(df / 2) * np.power(df * np.pi, d / 2.0)\
            * np.power(np.linalg.det(sigma), 1 / 2.0)\
            * np.power(1 + (1. / df)\
            * np.sum(xSigma * (x - mu), axis=1), (d + df) / 2)
        result = num / denom
        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号