Joint and Conditional Entropy
Pairs carry joint surprise; knowing one variable discounts the other. The chain rule splits the pair into staged, additive predictions.
Why Does This Exist?
Features arrive in bundles: pixels, tokens, sensors. Pricing the bundle's surprise as the sum of singles overcounts whenever variables correlate, and undercounts nothing ever. Compression, feature selection, and sequential prediction all need the pair price and the discount-for-knowing.
Definitions: and , averaging over . Chain: . It extends entropy to pairs and feeds mutual information as the overlap.
The one idea you need first
Entropy averages : fair coin bit. Joint entropy runs the same average over pairs; conditional subtracts what already told you.
Think of It Like This
Two weather reporters
Two reporters cover neighboring towns. Reading both fresh takes two minutes (joint). Reading the second after the first takes less: shared weather isold news (conditional discount).
Independent towns: no discount. Identical towns: second report free. Where it stops: reporters editorialize, adding noise. Conditional entropy assumes the true joint, not two biased retellings.
How It Actually Works
Chain generalizes: , the compression order matters only for the splits, never the total. Conditioning reduces entropy: , equality for independence. MI is the discount: . Estimation from counts needs smoothing; plug-in underestimates with few samples (Miller-Madow corrects in nats).
Worked example
Two independent fair coins: 4 pairs at each, bits. , , chain . Correlate: , . Margins stay fair (1 bit each), joint bits. Conditional , MI : correlation donated 0.278 bits of discount.
Code
import numpy as np
p = np.array([0.4, 0.1, 0.1, 0.4]) # 00,01,10,11h_joint = float(-(p * np.log2(p)).sum())print(round(h_joint, 3)) # -> 1.722print(round(h_joint - 1.0, 3)) # -> 0.722 conditionalJoint 1.722 minus 1 bit margin leaves 0.722 conditional. Same margins, dependence moves the total.
Watch Out For
Summing marginal entropies for correlated features
Adding per-feature entropies double-counts shared bits: joint can be far below the sum (1.722 vs 2.0 above). Feature-selection budgets built on sums overbuy capacity.
Price bundles jointly or subtract MI. If features correlate above 0.5, the sum is fiction.
Trusting plug-in entropy on small samples
Few samples make rare pairs invisible, so plug-in runs low by roughly nats. Lane: 100 samples over 64 pairs biases down ~0.3 nats (~0.45 bits).
Smooth, use Miller-Madow or NSB estimators, or collect more. If unseen pairs abound, the estimate is a floor.
The Quick Version
- Joint entropy prices pairs; conditional prices the remainder after knowing one.
- Chain: ; -way chains telescope the same way.
- Independent fair coins total 2 bits; the correlated example totals 1.722 with MI 0.278.
- Conditioning never increases entropy; independence holds equality.
- Never sum margins for correlated bundles; subtract the overlap.
- Smooth small-sample estimates or quote them as floors.