selfinformation
Self-information, also called surprisal, is a measure of the information content associated with a particular outcome of a random variable. It quantifies how unexpected or informative an event is given its probability distribution.
For a discrete random variable X with outcomes x and probability p(x), the self-information of x is
The average self-information across all outcomes is the entropy H(X) = E[I(X)] = - sum_x p(x) log_b p(x). The
Key properties include that I(x) ≥ 0, with equality only if p(x) = 1; I(x) increases as the
Extensions include continuous variables, where a related quantity i(x) = -log f(x) uses the probability density f(x).