Surprise is the logarithm of improbability
Shannon's self-information of an outcome x with probability p(x) is
A certain event (p = 1) tells you nothing. A rare event tells you a lot.
Why a logarithm? Independent events multiply their probabilities, and we want their information to add. A 1-in-4 event followed by a 1-in-2 event has probability 1/8 and surprise 2 + 1 = 3 bits.
With base-2 logs the unit is the bit: the surprise of a fair coin landing heads. Machine-learning libraries use the natural log, which gives nats (1 nat ≈ 1.443 bits). Switch units in the bar at the top.