x_analytical_values.py 文件源码

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

项目:adversarial-variational-bayes 作者: gdikov 项目源码 文件源码
def analytical_value_h_sharma_mittal(distr, alpha, beta, par):
    """ Analytical value of the Sharma-Mittal entropy.

    Parameters
    ----------    
    distr : str
            Name of the distribution.
    alpha : float, 0 < alpha \ne 1
            Parameter of the Sharma-Mittal entropy.
    beta : float, beta \ne 1
           Parameter of the Sharma-Mittal entropy.

    par : dictionary
          Parameters of the distribution. If distr = 'normal' : par["cov"] 
          = covariance matrix.

    Returns
    -------
    h : float
        Analytical value of the Sharma-Mittal entropy.

    References
    ----------   
    Frank Nielsen and Richard Nock. A closed-form expression for the 
    Sharma-Mittal entropy of exponential families. Journal of Physics A: 
    Mathematical and Theoretical, 45:032003, 2012.

    """

    if distr == 'normal': 
        # par = {"cov": c}
        c = par['cov']
        dim = c.shape[0]  # =c.shape[1]
        h = (((2*pi)**(dim / 2) * sqrt(absolute(det(c))))**(1 - beta) /
             alpha**(dim * (1 - beta) / (2 * (1 - alpha))) - 1) / \
            (1 - beta)

    else:
        raise Exception('Distribution=?')

    return h
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号