def analytical_value_h_renyi(distr, alpha, par):
""" Analytical value of the Renyi entropy for the given distribution.
Parameters
----------
distr : str
Name of the distribution.
alpha : float, alpha \ne 1
Parameter of the Renyi entropy.
par : dictionary
Parameters of the distribution. If distr = 'uniform': par["a"],
par["b"], par["l"] <- lxU[a,b]. If distr = 'normal' : par["cov"]
is the covariance matrix.
Returns
-------
h : float
Analytical value of the Renyi entropy.
References
----------
Kai-Sheng Song. Renyi information, loglikelihood and an intrinsic
distribution measure. Journal of Statistical Planning and Inference
93: 51-69, 2001.
"""
if distr == 'uniform':
# par = {"a": a, "b": b, "l": l}
# We also apply the transformation rule of the Renyi entropy in
# case of linear transformations:
h = log(prod(par["b"] - par["a"])) + log(absolute(det(par["l"])))
elif distr == 'normal':
# par = {"cov": c}
dim = par["cov"].shape[0] # =c.shape[1]
h = log((2*pi)**(dim / 2) * sqrt(absolute(det(par["cov"])))) -\
dim * log(alpha) / 2 / (1 - alpha)
else:
raise Exception('Distribution=?')
return h
x_analytical_values.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录