shared.py 文件源码

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

项目:adversarial-variational-bayes 作者: gdikov 项目源码 文件源码
def normal_density_at_zero(m, c):
    """ Compute the normal density with given mean and covariance at zero. 

    Parameters
    ----------    
    m : vector
        Mean.
    c : ndarray
        Covariance matrix. Assumption: c is square matrix and its size is 
        compatible with that of m.

    Returns
    -------
    g : float
        Computed density value.

    """

    dim = len(m)
    g = 1 / ((2 * pi)**(dim / 2) * sqrt(absolute(det(c)))) *\
        exp(-1/2 * dot(dot(m, inv(c)), m))

    return g
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号