def avgdigamma(points, dvec):
# This part finds number of neighbors in some radius in the marginal space
# returns expectation value of <psi(nx)>.
N = len(points)
tree = ss.cKDTree(points)
avg = 0.
for i in xrange(N):
dist = dvec[i]
# Subtlety, we don't include the boundary point,
# but we are implicitly adding 1 to kraskov def bc center point is included.
num_points = len(tree.query_ball_point(points[i], dist-1e-15,
p=float('inf')))
avg += digamma(num_points) / N
return avg
评论列表
文章目录