§7.10–7.11Sparse Representations · Bagging and Other Ensemble Methods

Part II DL pp. 254–257 · ~4 min read

  • sparse representation
  • representational regularization
  • orthogonal matching pursuit (omp-k)
  • bagging (bootstrap aggregating)
  • boosting

§7.10 Sparse representations

Weight decay penalizes the parameters. A different idea is to penalize the activations — pushing the hidden units toward zero. That is a sparse representation , and it is a distinct thing from a sparse parametrization. An L¹ penalty on the weights zeroes entries of the weight matrix; an L¹ penalty on the representation zeroes entries of the code h\boldsymbol{h}. Both describe the same linear system y=Ax\boldsymbol{y}=\boldsymbol{A}\boldsymbol{x}, but the zeros live in different places:

sparse parametrizationAx (dense)sparse representationBh (sparse)

Representational sparsity is achieved with the same machinery — just aimed at h\boldsymbol{h}:

Term by term

J~(θ;X,y)=J(θ;X,y)+αΩ(h)\tilde{J}(\boldsymbol{\theta}; \boldsymbol{X}, \boldsymbol{y}) = J(\boldsymbol{\theta}; \boldsymbol{X}, \boldsymbol{y}) + \alpha\,\Omega(\boldsymbol{h})
Ω(h)=h1\Omega(\boldsymbol{h}) = \lVert\boldsymbol{h}\rVert_1an L¹ penalty on the REPRESENTATION (not the weights) drives its elements to zero — representational sparsitynorm penalty on h
other choices\text{other choices}a Student-t prior, or a KL-divergence penalty pushing the average activation (1/m)Σhᵢ toward a small target like 0.01 (handy when h ∈ [0,1])alternatives
OMP-k\text{OMP-}kor a HARD constraint: orthogonal matching pursuit solves argmin‖x−Wh‖² with at most k non-zeros (‖h‖₀ < k), efficient when W is orthogonalhard version

Essentially any model with hidden units can be made sparse this way — OMP-1 is even an effective standalone feature extractor for deep architectures.

§7.11 Bagging and other ensemble methods

Bagging reduces generalization error by training several models separately and having them vote — an instance of model averaging . It works because different models rarely make all the same errors. Make that precise: suppose kk regressors each have per-example error variance vv and pairwise covariance cc. The averaged prediction’s expected squared error is:

Term by term

E ⁣[(1kiϵi)2]=1kv+k1kc\mathbb{E}\!\left[\Big(\tfrac{1}{k}\textstyle\sum_i \epsilon_i\Big)^2\right] = \tfrac{1}{k}v + \tfrac{k-1}{k}c
1kv\tfrac{1}{k}vthe variance term — shrinks like 1/k as the ensemble growsshrinks with k
k1kc\tfrac{k-1}{k}cthe covariance term — governed by how CORRELATED the members errors are; it tends to c as k growsthe ceiling
c=01kvc=0 \Rightarrow \tfrac{1}{k}vindependent errors → error falls linearly in k. Perfectly correlated (c=v) → stays v, no benefit at allthe two limits

Drag kk and the error correlation cc to see the two regimes:

Ensemble MSE = v/k + (k−1)/k·c: independent errors (c=0, green) fall as v/k; identical errors (c=v, red) give no improvement
ensemble size kensemble MSEv0c = v (no help)c = 0 → v/k
MSE = v/k + (k−1)/k · c
= 0.167 + 0.167
= 0.333
(v = 1)

If the models make identical errors (c = v), the green and red curves meet and averaging does nothing. As the errors become independent (c → 0), the ensemble error falls like v/k — that is the whole point of bagging.

Concretely, bagging builds kk datasets by sampling the original with replacement (each ends up missing some examples and duplicating others — about ⅔ of the originals appear in each), trains one model per dataset, and averages. The differing datasets make the models differ:

resample 18 8 6member learns“loop on TOP → 8”resample 28 9 9member learns“loop on BOTTOM → 8”averagerobust: needsBOTH loops

Ensembles for free — and the boosting exception

Neural nets reach so many different solutions that they benefit from model averaging even trained on the same dataset — differences in random initialization, minibatch order, and hyperparameters make their errors partly independent. Model averaging is powerful enough that it is discouraged in benchmark papers (any method gains from it, at a compute cost) yet routinely wins competitions. One caveat: not every ensemble is a regularizer. Boosting incrementally adds members to build an ensemble with higher capacity than any individual — the opposite intent to bagging’s variance reduction.

Next: dropout — which makes bagging practical for exponentially many neural networks at once — dropout, part 1.

Check yourself — sparse representations and bagging

1.What is the difference between a sparse parametrization and a sparse representation?

2.How do you induce representational sparsity, and what is OMP-k?

3.For k models with error variance v and covariance c, the ensemble MSE is (1/k)v + ((k−1)/k)c. What do the two extremes of c give?

4.In BaggingLab, set c = 0 and slide k from 1 to 20. What happens to the ensemble MSE, and why does bagging use resampling with replacement?

5.Why is boosting NOT a variance-reducing regularizer like bagging?

5 questions