Read the equation
The two terms are the uncertainty of a Bernoulli outcome with probabilities p and 1−p. With natural logarithms it is measured in nats, is zero at the deterministic endpoints by continuity, and has maximum log2 at p=0.5. The input must lie in [0,1].
Terms & definitions
| Term | Meaning in this source |
|---|---|
| p | Probability of one outcome |
| H | Binary entropy |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
// Gaussian kernel: K(x,y) = exp(-||x-y||²/2σ²)
inline double gaussian_kernel(double x, double y, double sigma = 1.0) {
double diff = x - y;
return std::exp(-diff * diff / (2.0 * sigma * sigma));
}
// Shannon entropy: H(p) = -p·log(p) - (1-p)·log(1-p)
inline double binary_entropy(double p) {
if (p <= 0.001 || p >= 0.999) return 0.0;
return -(p * std::log(p) + (1.0 - p) * std::log(1.0 - p)) / LN2;
}
// Mutual information approximation
inline double mutual_info(double x, double y) {
double xy = x * y;
double hx = -x * std::log(x + 0.001) / LN2;
double hy = -y * std::log(y + 0.001) / LN2;Exact original notation
Shannon entropy: H(p) = -p·log(p) - (1-p)·log(1-p)