Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 1

Decision regions, loss, the reject option, entropy and KL divergence

Two classes C1 and C2 generate a single input x from Gaussians. The best rule uses the posterior probabilities p(Ck|x): assign x to the class with the smallest expected loss, and refuse to decide when even the best choice is too risky. The shaded areas under the joint densities are the probability of a mistake. The other two views show the entropy of a discrete distribution (largest for the uniform distribution) and the Kullback-Leibler divergence between two Gaussians (never negative, not symmetric).

Show

Mean of C1

Mean of C2

Std of C1

Std of C2

Prior p(C1)

Loss L(C1→C2)

Loss L(C2→C1)

Threshold x̂ (R1 on the C1 side)

Threshold θ

Shape

Width s (in bins)

Mean of p

Mean of q

Std of p

Std of q

Try these

Class-conditional densities are N(μk, σk2) and the joint density is p(x, Ck) = p(Ck) p(x|Ck). Areas are computed on a grid of 2001 points over [−5, 8] by the trapezoidal rule, the same grid and rule as code/ch01_introduction.py. The loss of a correct decision is 0; the reject option costs λ = 1 − θ, so with 0–1 loss it rejects exactly where the larger posterior is at most θ (Section 1.5.3). In the entropy view the bins are indexed 0, …, 29 and the probabilities are proportional to a Gaussian bump (or two, or a flat floor with a spike).

In the lecture notes