Skip to content
mlmentorship

Entropy and mutual information: a noisy observation

Derive uncertainty removed from a joint table, then change the prior and the observation grouping without confusing information with causation.

Published · 13 min read ·Core ·Intermediate

Visual quick review

See mutual information as the part of X's uncertainty removed by observing Y, while the noisy-channel inset explains why both marginals can remain fair.

Worked uncertainty budget

Fair marginals can still share 0.531 bits of information

A noisy shared bit retains information despite fair marginalsFair input has one bit of uncertainty. A noisy output removes only some: 0.531 bits here, while 0.469 remain. Equal marginal frequencies do not imply independence; the conditional paths matter. Making both outgoing paths equally likely removes predictive value. Dependence does not establish causation.Fair bits can still predict eachother0011Equal inputsharesEqual outputsharesThick paths: 90% retain the input bitThin paths: 10% flip itInformation retained:0.531 bitsBefore observing: one bit uncertainAfter observing this noisy channel0.469 bitsremain0.531 bits removedRemoved share is the mutualinformation.Change: each outgoing path is equallylikely0011Output now removes no uncertaintyOne bit remains; mutual informationis zero.
Read it this way: Fair input has one bit of uncertainty. A noisy output removes only some: 0.531 bits here, while 0.469 remain. Equal marginal frequencies do not imply independence; the conditional paths matter. Making both outgoing paths equally likely removes predictive value. Dependence does not establish causation. If both outgoing paths became equally likely, would the input still predict the output?
Full explanation 13 min read
Reading depth

Entropy measures expected surprisal, while mutual information measures the uncertainty removed by observing another variable. Can two fair bits each have one bit of uncertainty while one reveals only part of the other?

Summary

Use finite discrete variables and base-two logarithms unless stated otherwise. Our teaching fixture sends a fair bit through independent noise that flips it with probability . We will compute the joint table before subtracting uncertainty. Population information is not a causal effect or a guarantee about an empirical estimate.

Discrete entropy and units

Outcome has surprisal for logarithm base . Entropy averages that quantity:

Base two gives bits, base gives nats, and base ten gives hartleys. The conversion is . A deterministic variable has zero entropy. On a fixed support of outcomes, uniform mass maximizes entropy at . Relabeling preserves entropy; merging outcomes can reduce it.

Three worked examples

Fair bit

For , each outcome has surprisal one bit. Therefore .

Perfect copy

If , observing determines . The remaining entropy is zero, so the removed uncertainty is one bit. The pair has only two possible states, not four equally likely states.

Binary noisy channel

Let be independent of the fair input, and set . Multiply input mass by the copy or flip probability:

Joint massRow total
Column total

Both marginals are fair, but agreement has probability . Independent fair bits would instead give in every cell.

Reference drawing

Worked uncertainty budget

Fair marginals can still share 0.531 bits of information

A noisy shared bit retains information despite fair marginalsFair input has one bit of uncertainty. A noisy output removes only some: 0.531 bits here, while 0.469 remain. Equal marginal frequencies do not imply independence; the conditional paths matter. Making both outgoing paths equally likely removes predictive value. Dependence does not establish causation.Fair bits can still predict eachother0011Equal inputsharesEqual outputsharesThick paths: 90% retain the input bitThin paths: 10% flip itInformation retained:0.531 bitsBefore observing: one bit uncertainAfter observing this noisy channel0.469 bitsremain0.531 bits removedRemoved share is the mutualinformation.Change: each outgoing path is equallylikely0011Output now removes no uncertaintyOne bit remains; mutual informationis zero.
Derivation

One bit splits into 0.531 bits removed by Y and 0.469 bits still uncertain.

Mutual information is the uncertainty removed by observing another variable A one-bit horizontal bar for H of X is split into zero point five three one bits removed by Y and zero point four six nine bits still uncertain after Y. A second inset shows a two by two joint table where diagonal match probabilities are zero point four five and off-diagonal flip probabilities are zero point zero five, with both marginals equal to one half. One bit of X before observing Y binary noisy channel with flip probability 0.1 0.531 bits removed by observing Y 0.469 bits still uncertain: H(X|Y) I(X;Y) = H(X) - H(X|Y) = 1.000 - 0.469 H(X) H(Y) shared 0.531 Overlap is a memory aid: shared information, not a causal direction. Fair marginals can still depend mass concentrates on agreement 0.45 0.05 0.05 0.45 Y=0 Y=1 X=0 X=1 row = 0.50 row = 0.50 column totals also 0.50 / 0.50 Y is fair, but usually equal to X That diagonal concentration is the shared information.
Read it this way: the full bar is the input's one bit of uncertainty. Observing Y removes 0.531 bits and leaves 0.469 bits. The diagonal table entries explain the dependence despite fair marginals. The circles are a memory aid, not a proof or causal diagram.
Check: Why can both marginals be fair while observing Y removes about 0.531 bits of uncertainty about X?
Read it this way: Fair input has one bit of uncertainty. A noisy output removes only some: 0.531 bits here, while 0.469 remain. Equal marginal frequencies do not imply independence; the conditional paths matter. Making both outgoing paths equally likely removes predictive value. Dependence does not establish causation. If both outgoing paths became equally likely, would the input still predict the output?

Conditional entropy

Given either output, the input matches it with probability . Write . Average the posterior entropies over the output probabilities:

Conditioning reduces entropy on average, not necessarily for every particular observed value. Using inside the logarithm proves the chain rule:

Mutual information in equivalent forms

Subtract remaining uncertainty:

The reference gives bits. The table independently gives , the same result. The middle expression proves symmetry; it does not supply a causal direction. Gibbs’ inequality applied to the last expression gives nonnegativity, with equality exactly at independence. Nonnegative conditional entropies also give .

Change the input prior

Set , retaining independent flips with probability . The four joint cells become in row order. Now , and

Recompute marginals when class priors change; the fair-input shortcut no longer applies.

Information gain in decision trees

Let be a label and identify its tree child. Split four balanced-label records into one pure record and three records with class counts one and two.

Use record weights, not an unweighted child average. Perfect separation gives one bit; unchanged child proportions give zero. This is mutual information under the node’s empirical distribution, not evidence of generalization.

Conditional mutual information

For independent fair , the target is independent of either input alone. Thus , while bit. Marginal ranking misses the interaction. Conditional information measures the added association after context is known:

For XOR, bit. Conditioning can create association, including through a common effect; this is not automatically a causal test.

Reconstruct: what changes at flip probability , or when the observation is replaced by a constant?

Answer

Inverting the channel recovers the channel, preserving bits. A constant observation leaves all input uncertainty, giving zero mutual information.

Coding interpretation

For known iid symbols, a binary prefix code’s expected length is at least . Huffman coding achieves expected length below . Arithmetic coding over sequences can approach the entropy rate more closely. These are average-length statements, not lengths promised for every message. Dependent symbols instead permit conditional coding:

Cross-entropy and KL divergence

For source law and model law , expected log loss decomposes as

Add and subtract to obtain the identity. For fixed , minimizing cross-entropy minimizes forward KL. Missing support where makes both quantities infinite. A mismatched ideal coder incurs this same expected excess length.

The joint-table expression above is . Equivalently, information averages posterior-to-prior divergence:

Independence, symmetry, and processing

Zero Pearson correlation does not imply independence. For a Markov chain , data processing gives

Processing without new access to cannot create information about it. Invertible transformations preserve information. A useful representation can discard nuisance details while retaining task information.

Continuous variables need different care

For a density, differential entropy is . It can be negative and depends on scale:

A uniform variable on has differential entropy bit. Converting meters to centimeters adds without adding information. Continuous mutual information remains nonnegative and invariant under suitable invertible reparameterizations. For a non-atomic continuous variable, an exact copy has infinite mutual information. The joint law is singular relative to the product law, so an ordinary joint-density formula is unavailable. Binning creates a discrete variable whose entropy depends on bin width. State whether the quantity uses densities, quantized values, or a continuous information estimator.

Estimation from finite data

The plug-in entropy substitutes empirical frequencies:

It is downward biased; unseen outcomes receive zero mass. For well-sampled fixed discrete support, Miller-Madow adds approximately

Here counts observed categories and counts iid observations. Under regular fixed-support independence, plug-in mutual information has approximate upward null bias

Sparse joint tables invalidate these expansions; more dimensions rapidly exhaust observed support. Continuous estimators use bins, kernels, neighbors, density ratios, or learned critics, each with tuning assumptions. Report the estimator, units, sample size, preprocessing, and tuning choices. Use an appropriate permutation null for spurious dependence and repeated sampling for uncertainty. Bootstrap variation cannot restore unseen support or eliminate structural estimator bias.

Feature selection does not establish causation

Compute feature selection inside each training fold; full-data ranking leaks target information into evaluation. Confounding, target-derived fields, and logging policies can all create association. None establishes the effect of intervening on the feature. Duplicate features can each score highly while adding nothing together; XOR shows the opposite interaction. Conditional information asks about incremental association but requires estimating a larger conditioning space. Validate selected features on held-out data and inspect provenance. Tree split searches can exploit accidental gain; constrain leaf size, prune, and evaluate independently. Regression trees usually optimize variance or squared-error reduction, not Shannon entropy.

InfoNCE and representation learning

Under the standard construction, comes from the joint law. The other candidates are independent marginal draws. With natural logarithms and critic , the expected loss satisfies

This lower bound is capped at and can be loose. Correlated negatives or sampling shortcuts can violate its construction or weaken its relevance. Semantically matching negatives can also occur under valid marginal sampling; semantics alone do not invalidate the bound. Lower loss demonstrates discrimination against sampled alternatives, not an exact information measurement or universal downstream preservation.

Predictive entropy, calibration, and confidence

Predictive entropy measures spread within the model’s stated distribution. A wrong prediction with probability can have very low entropy. High entropy can reflect ambiguity, missing inputs, or model failure. Calibration compares predicted probabilities with frequencies in a stated population. Proper population log loss does not make finite, misspecified, selected, or shifted predictions automatically calibrated. Entropy is not a confidence interval. Ensemble and parameter-label information also depend on model and posterior assumptions.

Interview procedure

Name the variables, probability law, and log base. Rebuild marginals, then conditionals, before calculating removed uncertainty. Check the entropy and joint-ratio forms agree. State sampling, causation, and confidence limitations separately from population identities.

Common mistakes

  • Missing units or child weights changes the reported quantity.
  • Symmetry is not causation, and zero correlation is not independence.
  • Discrete and differential entropies have different scale behavior.
  • InfoNCE and plug-in estimates are not exact population measurements.
  • Low predictive entropy is not calibrated confidence.
  • Dependent observations cannot contribute independent information merely because they occupy different rows.

Changed-assumption practice

At flip probability , every joint cell is and information is zero. At , invert the output to recover the reference information. With prior , recompute the output mass instead of assuming fairness. A constant transformation discards all information; inversion preserves it. Two conditionally independent -flip copies yield about bits jointly, not twice . Their outputs are dependent through the shared input. A unique-per-row tree feature can memorize labels; fresh-data evaluation or leaf constraints are still required.