The Mean Network Is the Geometric Mean of All Dropout Networks
The dropout paper states that for a network with one hidden layer of H units and a softmax output, the mean network (all units present, outgoing hidden weights halved) gives exactly the geometric mean of the label distributions predicted by all 2H dropout networks. Check it by building the whole ensemble.
Implement dropout_ensemble(x, W1, b1, W2, b2).
Inputs
x: one input, shape (D,). W1 (D, H), b1 (H,), W2 (H, K), b2 (K,), with 1≤H≤12.
- The hidden activities are a=ReLU(xW1+b1). Dropout acts on the hidden units only, each omitted with probability 0.5, so every one of the 2H masks m∈{0,1}H is equally likely.
The ensemble: for each mask m, the dropout network predicts Pm=softmax((a⊙m)W2+b2).
Output: a tuple (geo, arith, mean_net) of arrays of shape (K,):
geo: the renormalized geometric mean,
geok=∑jGjGk,Gk=(∏mPm,k)1/2H.
arith: the arithmetic mean 2H1∑mPm.
mean_net: softmax(0.5aW2+b2).
Notes
- Individual probabilities can be far below 10−300 when multiplied over a thousand networks; compute the geometric mean from log-probabilities.
- Use a numerically stable softmax and log-softmax.