latentmi.ksg

Functions

add_noise(x[, intens])

query_neighbors(tree, x, k)

count_neighbors(tree, x, r)

avgdigamma(points, dvec)

tweaked this to return list of psi(nx) for pointwise estimate

build_tree(points)

lnc_correction(tree, points, k, alpha)

in my experience this doesn't work in practice for N_dims > 1

entropy(x[, k, base])

The classic K-L k-nearest neighbor continuous entropy estimator

mi(x, y[, z, k, base, alpha])

Mutual information of x and y (conditioned on z if z is not None)

entropyd(sx[, base])

Discrete entropy estimator

centropyd(x, y[, base])

The classic K-L k-nearest neighbor continuous entropy estimator for the

midd(x, y[, base])

Discrete mutual information estimator

out_of_sample_avgdigamma(obs_points, est_points, dvec)

here we compute psi(nx) for query points that are not

out_of_sample_pmi(obs_x, obs_y, est_x, est_y[, k, base])

Module Contents

latentmi.ksg.add_noise(x, intens=1e-10)[source]
latentmi.ksg.query_neighbors(tree, x, k)[source]
latentmi.ksg.count_neighbors(tree, x, r)[source]
latentmi.ksg.avgdigamma(points, dvec)[source]

tweaked this to return list of psi(nx) for pointwise estimate

latentmi.ksg.build_tree(points)[source]
latentmi.ksg.lnc_correction(tree, points, k, alpha)[source]

in my experience this doesn’t work in practice for N_dims > 1

latentmi.ksg.entropy(x, k=3, base=2)[source]

The classic K-L k-nearest neighbor continuous entropy estimator x should be a list of vectors, e.g. x = [[1.3], [3.7], [5.1], [2.4]] if x is a one-dimensional scalar and we have four samples

latentmi.ksg.mi(x, y, z=None, k=3, base=2, alpha=0)[source]

Mutual information of x and y (conditioned on z if z is not None) x, y should be a list of vectors, e.g. x = [[1.3], [3.7], [5.1], [2.4]] if x is a one-dimensional scalar and we have four samples

latentmi.ksg.entropyd(sx, base=2)[source]

Discrete entropy estimator sx is a list of samples

latentmi.ksg.centropyd(x, y, base=2)[source]

The classic K-L k-nearest neighbor continuous entropy estimator for the entropy of X conditioned on Y.

latentmi.ksg.midd(x, y, base=2)[source]

Discrete mutual information estimator Given a list of samples which can be any hashable object

latentmi.ksg.out_of_sample_avgdigamma(obs_points, est_points, dvec)[source]

here we compute psi(nx) for query points that are not necessarily part of observed samples

Parameters:
  • obs_points

  • est_points

  • dvec

latentmi.ksg.out_of_sample_pmi(obs_x, obs_y, est_x, est_y, k=3, base=2)[source]