tf.contrib.bayesflow.entropy.entropy_shannon(p, z=None, n=None, seed=None, form=None, name='entropy_shannon')
Monte Carlo or deterministic computation of Shannon's entropy.
Depending on the kwarg form, this Op returns either the analytic entropy of the distribution p, or the sampled entropy:
-n^{-1} sum_{i=1}^n p.log_prob(z_i), where z_i ~ p,
\approx - E_p[ Log[p(Z)] ]
= Entropy[p]
User supplies either Tensor of samples z, or number of samples to draw n
Args:
-
p:tf.contrib.distributions.BaseDistribution -
z:Tensorof samples fromp, produced byp.sample_n(n)for somen. -
n: IntegerTensor. Number of samples to generate ifzis not provided. -
seed: Python integer to seed the random number generator. -
form: EitherELBOForms.analytic_entropy(use formula for entropy ofq) orELBOForms.sample(sample estimate of entropy), orELBOForms.default(attempt analytic entropy, fallback on sample). Default value isELBOForms.default. -
name: A name to give thisOp.
Returns:
A Tensor with same dtype as p, and shape equal to p.batch_shape.
Raises:
-
ValueError: Ifformnot handled by this function. -
ValueError: IfformisELBOForms.analytic_entropyandnwas provided.
Please login to continue.