lnn.py 文件源码

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

项目:lnn 作者: wgao9 项目源码 文件源码
def KDE_entropy(x):
    '''
        Estimate the entropy H(X) from samples {x_i}_{i=1}^N
        Using Kernel Density Estimator (KDE) and resubstitution

        Input: x: 2D list of size N*d_x

        Output: one number of H(X)
    '''

    N = len(x)
    d = len(x[0])
    local_est = np.zeros(N)
    for i in range(N):
        kernel = sst.gaussian_kde(x.transpose())
        local_est[i] = kernel.evaluate(x[i].transpose())
    return -np.mean(map(log,local_est))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号