Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

6. Prior entropy

Here we demonstrate computing the entropy of a prior distribution, numerically. The informativeness of a prior distribution is linked to its entropy. The larger the entropy, the less informative the prior distribution is. The entropy of a univariate continuous distribution with probability density function p(x)p(x) is defined as:

H(p)=−∫−∞∞p(x)log⁡(p(x))dxH(p) = -\int_{-\infty}^{\infty} p(x) \log(p(x)) dx

Here, we will compute the entropy of continuous univariate distributions numerically to compare their informativeness relative to each other. Let us define a Gaussian distribution x:

Let us define a lambda function for the entropy integrand:

To compute the entropy, we can use scipy’s quad function to integrate the entropy integrand over the support of the distribution:

Entropy of x: 
1.4189385332046731