Chapter 11 of 0–21
Measuring fit and sparsity
Variance explained, least squares, SVD/PCA and the Gini coefficient.
To claim “the network computes X” we must say how well X describes it. This chapter collects the yardsticks the paper and ARENA use.
Mean, variance and how much an approximation explains
The mean of a list is its average. The variance is the average squared distance from the mean — how spread out the numbers are.
For y = (1, 2, 3, 6): mean = 12/4 = 3; variance = ((1−3)² + (2−3)² + (3−3)² + (6−3)²)/4 = (4 + 1 + 0 + 9)/4 = 3.5.
If we approximate data y by some prediction ŷ, the residual is what is left, y − ŷ. The fraction of variance explained compares the leftover with the original spread:
FVE = 1 means the approximation is perfect; FVE = 0 means it is no better than always predicting the mean.
Least squares
Least squares chooses the free coefficients of an approximation to make the sum of squared residuals as small as possible. The paper fits the logits this way (chapter 15), ARENA fits neuron activations this way (chapter 14).
Fitting a line ŷ = α + βx to y = (1, 2, 3, 6) at x = (0, 1, 2, 3). Least squares gives α = 0.6, β = 1.6, predictions (0.6, 2.2, 3.8, 5.4), residuals (0.4, −0.2, −0.8, 0.6). Sum of squared residuals 1.2, total sum of squares around the mean 14, so FVE = 1 − 1.2/14 ≈ 0.914: a line explains 91 % of the variance.
How many directions does a matrix use? SVD and PCA
The singular value decomposition writes any matrix as rotation × stretching × rotation, M = U\,\mathrm{diag}(s_1, s_2, \ldots)\,V^\top [29]. The stretch factors s_1 \ge s_2 \ge \ldots \ge 0 are the singular values; the number of non-zero ones is the rank (chapter 3). Many tiny singular values mean the matrix effectively uses only a few directions.
\begin{pmatrix}3&0\\0&1\end{pmatrix} has singular values 3 and 1. \begin{pmatrix}1&2\\2&4\end{pmatrix} has singular values 5 and 0 — its second row is twice its first, so it only ever outputs multiples of one direction (rank 1).
Principal component analysis applies the same idea to a cloud of points: it finds the directions along which the points vary most, so we can draw a 128-dimensional cloud faithfully in 2D [30]. ARENA uses the SVD of the embedding matrix to see how many directions it uses during training [3]:
Singular values of the embedding
The 113 singular values of W_E (largest first) at the selected step.
Loading…
How to read it
<div class="fig-read"><p>A <a class="term" data-term="svd" href="../glossary.html#svd">singular value decomposition (SVD)</a> shows how many independent directions the embedding really uses.</p>