Estimation Is Projection

Why the best linear estimate is a right angle

Half a face from the other half

Guessing what you cannot see

Three portraits the estimator never saw: the observed left half, the estimate written into the right half, the truth, the error, and the error the estimator predicts for each pixel.

The estimate is a linear combination of the 2048 visible pixels, and it needs nothing but the covariance matrix of the random-vector week. This week shows why that combination is found by drawing a right angle.

The plan for the week

The principle. Random variables are vectors, the mean-square error is a squared distance, and the best estimate is a perpendicular dropped onto the observations: the normal equations.

Four readings of the same equation. A richer list of observations; the Gaussian case, where linear is already optimal; data instead of moments (least squares); and observations that arrive one at a time (innovations).

In the notes Random Variables as Vectors · The Orthogonality Principle and Normal Equations · Linear and Affine MMSE Estimation · Vector Targets and the Error Covariance · Beyond the Affine Estimator · Gaussian Estimation · Least Squares · Sequential Estimation and the Innovations

Random variables are vectors

A random variable is a vector

A random variable is a map from outcomes to numbers. On a finite sample space \(H=\set{\eta_1,\dots,\eta_M}\) it is nothing but the list of its values: \[X\;\longleftrightarrow\;\big[X(\eta_1),\ X(\eta_2),\ \dots,\ X(\eta_M)\big]\in\Complex^M .\]

One portrait with a left pixel X and a right pixel Y marked; twelve portraits as outcomes; the values of X and of Y on each, as two lists of stems.

One coordinate per outcome: not per sensor, not per time index. A linear combination \(aX+bY\) is the coordinatewise combination, and all of vector geometry applies.

…with the coordinates weighted by probability

Outcomes have different probabilities, so the inner product weights each coordinate: \[\sum_mX(\eta_m)\,Y\conj(\eta_m)\,\Prob{\eta_m}=\E{XY\conj}.\]

The two pixel lists X and Y multiplied outcome by outcome, then averaged over the 400 portraits: one number, the inner product.

Inner product of random variables \[\ip{X,Y}=\E{X\,Y\conj},\qquad\norm{X}^2=\E{\abs X^2}.\]

Expectation is the inner product. The probability measure says how much each coordinate counts, and the conjugate makes \(\norm X^2\) a real, nonnegative power.

The dictionary: two Hilbert spaces

vectors random variables
inner product \(\mathbf y\herm\mathbf x\) correlation \(\E{XY\conj}\)
squared length power \(\E{\abs X^2}\)
orthogonal uncorrelated (zero mean)
cosine of the angle correlation coefficient \(\rho\)
Cauchy–Schwarz \(\abs{\mathbf y\herm\mathbf x}\le\norm{\mathbf x}\norm{\mathbf y}\) \(\abs\rho\le1\)
Pythagoras \(\norm{\mathbf x+\mathbf y}^2=\norm{\mathbf x}^2+\norm{\mathbf y}^2\) powers of uncorrelated signals add
Gram matrix correlation matrix \(\mathbf R_{\mathbf{XX}}\)
squared distance \(\norm{\mathbf y-\widehat{\mathbf y}}^2\) mean-square error \(\E{\abs{Y-\widehat Y}^2}\)
orthogonal projection the optimal linear estimator

Read the last two rows together and the whole week is already visible. Pythagoras is the workhorse: every proof below that says “the error is orthogonal, so nothing shorter exists” is that one line.

The principle

MMSE with a linear restriction

Week 3 minimized \(\E{\abs{Y-g(\mathbf X)}^2}\) over every function \(g\) and found \(\E{Y\mid\mathbf X}\). Now restrict \(g\) to a linear combination of \(\mathbf X=[X_1,\dots,X_N]\tran\) (zero-mean target \(Y\)): \[\widehat Y=\mathbf w\herm\mathbf X=\sum_kw_k\conj X_k,\qquad J(\mathbf w)=\E{\abs{Y-\mathbf w\herm\mathbf X}^2}=\norm{Y-\widehat Y}^2 .\]

The linear MMSE estimator as a block diagram: observations weighted and summed, the error minimized.

In the dictionary: find the point of \(\mathrm{span}\set{X_1,\dots,X_N}\) closest to \(Y\). That is a projection, and projections are characterized by a right angle.

On a face: which weights?

The nine pixels of a \(3\times3\) patch on the left cheek are the observations \(X_1,\dots,X_9\), each a list over the 400 portraits. The target \(Y\) is one pixel on the right cheek.

A portrait with a 3x3 patch on the left and a target pixel on the right; the patch pixels as lists, each multiplied by a weight and summed, set against the target list.

Which nine numbers \(w_k\) make the weighted sum closest to \(Y\) over all 400 portraits? The next slides answer it in general; the answer for this patch closes the section.

The orthogonality principle

Orthogonality principle \(\widehat Y\) minimizes \(\E{\abs{Y-\widehat Y}^2}\) if and only if the error is orthogonal to every observation, \(\E{(Y-\widehat Y)\,X_k\conj}=0\) for \(k=1,\dots,N\).

The target Y, the plane spanned by the observations, and the error standing perpendicular to it.

“Minimize the mean-square error” and “drop a perpendicular” are the same instruction.

Why it is true

Orthogonality principle \(\widehat Y\) is optimal if and only if \(\E{(Y-\widehat Y)\,X_k\conj}=0\) for every \(k\).

Let \(\widetilde Y\) be any competitor in the span. Split its error: \[Y-\widetilde Y=\underbrace{(Y-\widehat Y)}_{\perp\text{ the span}}+\underbrace{(\widehat Y-\widetilde Y)}_{\in\text{ the span}} \quad\Longrightarrow\quad \norm{Y-\widetilde Y}^2=\norm{Y-\widehat Y}^2+\norm{\widehat Y-\widetilde Y}^2\ge\norm{Y-\widehat Y}^2 .\]

Equality only when \(\widetilde Y=\widehat Y\): optimal and unique.

The converse is the one used in practice: any correlation left between the error and an observation is information not yet used.

The normal equations

Substitute \(\widehat Y=\mathbf w\herm\mathbf X\) into the orthogonality conditions, all \(k\) at once: \[\E{(Y-\mathbf w\herm\mathbf X)\,\mathbf X\herm}=\mathbf r_{\mathbf{XY}}\herm-\mathbf w\herm\mathbf R_{\mathbf{XX}}=\mathbf 0,\qquad \mathbf R_{\mathbf{XX}}=\E{\mathbf X\mathbf X\herm},\quad \mathbf r_{\mathbf{XY}}=\E{\mathbf X\,Y\conj} .\]

Normal equations \[\mathbf R_{\mathbf{XX}}\,\mathbf w=\mathbf r_{\mathbf{XY}} \quad\Longrightarrow\quad \mathbf w\opt=\underbrace{\mathbf R_{\mathbf{XX}}^{-1}}_{\text{corrects the overlap}}\,\underbrace{\mathbf r_{\mathbf{XY}}}_{\text{raw similarity}} .\]

For the error \(E=Y-\widehat Y\) the square splits in two, and orthogonality removes one part: \[J_{\min}=\sigma_E^2=\E{E\,(Y-\widehat Y)\conj}=\E{E\,Y\conj}-\underbrace{\E{E\,\widehat Y\conj}}_{=0,\ E\perp\widehat Y}\] \[=\E{(Y-\mathbf w\opt{}\herm\mathbf X)\,Y\conj}=\sigma_Y^2-\mathbf w\opt{}\herm\mathbf r_{\mathbf{XY}} =\sigma_Y^2-\mathbf r_{\mathbf{XY}}\herm\mathbf R_{\mathbf{XX}}^{-1}\mathbf r_{\mathbf{XY}} .\]

The same equations by differentiation

\(J(\mathbf w)=\sigma_Y^2-\mathbf w\herm\mathbf r_{\mathbf{XY}}-\mathbf r_{\mathbf{XY}}\herm\mathbf w+\mathbf w\herm\mathbf R_{\mathbf{XX}}\mathbf w\) is a real quadratic in complex weights. Treating \(\mathbf w\) and \(\mathbf w\conj\) as independent (Wirtinger calculus), \[\frac{\partial J}{\partial\mathbf w\conj}=\mathbf R_{\mathbf{XX}}\mathbf w-\mathbf r_{\mathbf{XY}}=\mathbf 0 .\]

Completing the square: with \(\mathbf r_{\mathbf{XY}}=\mathbf R_{\mathbf{XX}}\mathbf w\opt\), add and subtract \(\mathbf w\opt{}\herm\mathbf R_{\mathbf{XX}}\mathbf w\opt\) so the quadratic form becomes a perfect square, \[J(\mathbf w)=\underbrace{\sigma_Y^2-\mathbf w\opt{}\herm\mathbf R_{\mathbf{XX}}\mathbf w\opt}_{J_{\min}} +(\mathbf w-\mathbf w\opt)\herm\mathbf R_{\mathbf{XX}}(\mathbf w-\mathbf w\opt).\] It is a bowl with its bottom at \(\mathbf w\opt\): \[J(\mathbf w)=J_{\min}+(\mathbf w-\mathbf w\opt)\herm\mathbf R_{\mathbf{XX}}(\mathbf w-\mathbf w\opt).\]

Calculus and geometry give the same answer, as they must. The geometry says why; the calculus is what you run when the cost is not a distance.

The error surface

Contours of J(w) for two weights: ellipses shaped by the eigenvectors and eigenvalues of R_XX, centered on the optimum.

\[\begin{aligned}J(\mathbf w)&=J_{\min}\\&\quad+(\mathbf w-\mathbf w\opt)\herm\mathbf R_{\mathbf{XX}}(\mathbf w-\mathbf w\opt)\end{aligned}\] \[J_{\min}=\sigma_Y^2-\mathbf r_{\mathbf{XY}}\herm\mathbf R_{\mathbf{XX}}^{-1}\mathbf r_{\mathbf{XY}}\]

Correlated observations tilt and stretch the bowl. The more elongated it is (the larger the eigenvalue spread), the flatter its floor along one direction, and the less well the data pin that direction down.

A four-outcome example

Four equally likely outcomes, so a random variable is a list of four numbers: \[X_1=[1,1,-1,-1],\qquad X_2=[1,-1,1,-1],\qquad Y=[3,1,1,-1].\]

The observations X_1, X_2 and the target Y, one bar per outcome.

The projection of Y and the residual, one bar per outcome.

\(\ip{X_1,X_2}=0\), so \(\mathbf R_{\mathbf{XX}}=\mathbf I\) and \(w_1=\ip{Y,X_1}=1\), \(w_2=\ip{Y,X_2}=1\). The residual \([1,1,1,1]\) is constant: the mean of \(Y\), which no zero-mean combination can reach.

With nonzero means: the affine estimator

Estimate the fluctuation and add the mean back:

Affine MMSE estimator \[\widehat Y=m_Y+\mathbf c_{\mathbf{XY}}\herm\mathbf C_{\mathbf{XX}}^{-1}(\mathbf X-\mathbf m_{\mathbf X}),\qquad \mathbf c_{\mathbf{XY}}=\E{(\mathbf X-\mathbf m_{\mathbf X})(Y-m_Y)\conj}.\]

Same equations, covariances in place of correlations. With no data the estimate is \(m_Y\) and the error \(\sigma_Y^2\); every observation is a correction to the prior mean.

The whole estimator needs four moments, \(\mathbf m_{\mathbf X}\), \(m_Y\), \(\mathbf C_{\mathbf{XX}}\), \(\mathbf c_{\mathbf{XY}}\), and one matrix solve.

Two noisy sensors, once more

Two noisy readings of one target \[X_k=Y+N_k,\qquad k=1,2.\] Zero-mean target of power \(\sigma_Y^2\), zero-mean noise independent of \(Y\) and of each other, with powers \(\sigma_1^2,\sigma_2^2\). Then \[\mathbf R_{\mathbf{XX}}=\begin{bmatrix}\sigma_Y^2+\sigma_1^2&\sigma_Y^2\\ \sigma_Y^2&\sigma_Y^2+\sigma_2^2\end{bmatrix} =\sigma_Y^2\mathbf 1\mathbf 1\tran+\diag(\sigma_1^2,\sigma_2^2),\qquad \mathbf r_{\mathbf{XY}}=\begin{bmatrix}\E{X_1Y\conj}\\ \E{X_2Y\conj}\end{bmatrix}=\sigma_Y^2\begin{bmatrix}1\\1\end{bmatrix},\] and the normal equations give \[\widehat Y=\frac{x_1/\sigma_1^2+x_2/\sigma_2^2}{1/\sigma_Y^2+1/\sigma_1^2+1/\sigma_2^2},\qquad \frac{1}{J_{\min}}=\frac{1}{\sigma_Y^2}+\frac{1}{\sigma_1^2}+\frac{1}{\sigma_2^2}.\]

The precision-weighted fusion of the Bayesian week, with the prior as a third sensor reading \(0\), recovered from second moments alone and without assuming Gaussian noise.

What ignoring the overlap costs

Error against the noise correlation rho of two sensors: the normal-equation weights, and weights solved as if the noises were uncorrelated.

With correlated noise the two readings repeat each other’s errors, and the raw similarities overcount them. \(\mathbf R_{\mathbf{XX}}^{-1}\) corrects for it; with anticorrelated noise it even exploits the cancellation.

Which pixels move together

Fix a reference pixel \(p\) and correlate it with every pixel \(q\), over the 400 portraits: \[\rho_{pq}=\frac{\E{(X_p-m_p)(X_q-m_q)}}{\sigma_p\,\sigma_q}.\] One row of the correlation matrix, drawn as an image; the cross marks \(p\).

Six correlation maps over the 400 portraits, one per reference pixel: right cheek, left cheek, left eye, mouth, forehead and background. Most of each face is positively correlated; each map is strongest around its own pixel, and the two cheek maps also light up the opposite cheek.

Every map is mostly positive: the lighting changes from photo to photo, so all pixels brighten and darken together. On top of that, a pixel is most like its neighbors, and a cheek is like the opposite cheek (\(\rho=0.56\)).

With numbers: the right cheek from a left patch

Left: the patch and target on a face, and below it the nine weights from the normal equations. Middle: the nine observations and the target with its projection over 28 portraits. Right: the residual against every observation, with no trend left.

The weights mix signs, because the nine pixels say almost the same thing (\(\mathbf R_{\mathbf{XX}}\) has condition number about 600). The mirror pixel alone (\(\rho=0.56\)) would leave 69% of the target’s variance as error; the patch leaves 57%. A face is only roughly symmetric.

A vector target: the error covariance

Estimate many targets at once, \(\mathbf Y\) (the whole right half of a face): each component gets its own normal equations, and the errors collect into one matrix:

Normal equations and error covariance Stack the weight vectors of the components as the columns of \(\mathbf W\): \[\mathbf C_{\mathbf{XX}}\mathbf W=\mathbf C_{\mathbf{XY}},\qquad \widehat{\mathbf Y}=\mathbf m_{\mathbf Y}+\mathbf W\herm(\mathbf X-\mathbf m_{\mathbf X}),\qquad \mathbf C_{\mathbf{XY}}=\E{(\mathbf X-\mathbf m_{\mathbf X})(\mathbf Y-\mathbf m_{\mathbf Y})\herm},\] \[\mathbf C_{\mathbf{EE}}=\mathbf C_{\mathbf{YY}}-\mathbf C_{\mathbf{XY}}\herm\mathbf C_{\mathbf{XX}}^{-1}\mathbf C_{\mathbf{XY}} .\] The prior spread, less what the observations explain. For one target it is the scalar \(\sigma_E^2=J_{\min}\); its diagonal is the per-pixel error map of the opening slide.

\(\mathbf C_{\mathbf{EE}}\) does not depend on the observed values: how well you will do is known before the measurement arrives. That is what makes it possible to design an experiment.

The right half from the left half

\(\mathbf X\): the left half of a portrait, 2048 pixels. \(\mathbf Y\): the right half, 2048 pixels. The moments come from 320 photos (8 of each person); 80 photos are held back. With 320 faces the \(2048\times2048\) \(\widehat{\mathbf C}_{\mathbf{XX}}\) is singular, so a small ridge makes the solve possible: \(\mathbf A=\widehat{\mathbf C}_{\mathbf{YX}}(\widehat{\mathbf C}_{\mathbf{XX}}+\delta\mathbf I)^{-1}\).

A held-out photo: the observed left half, the estimated right half, the truth and the error. Then the per-pixel error predicted by the error covariance, the error measured on 80 held-out photos, and one row of the error covariance.

The predicted map, \(\sqrt{\diag\mathbf C_{\mathbf{EE}}}\), exists before any held-out photo is seen, and the measured error has its shape (correlation 0.95): small near the mirror line, large at the hairline and the edge of the face. It is optimistic at the edge (0.11 against 0.16), because 320 faces only estimate the moments. The row of \(\mathbf C_{\mathbf{EE}}\): errors of neighboring pixels move together.

In the eigenbasis

Change the basis, keep the estimate

Any invertible \(\mathbf T\) gives observations \(\mathbf Z=\mathbf T\mathbf X\) with the same span, so the same projection: the weights change, never the estimate or the error.

Choose \(\mathbf T=\mathbf U\herm\) from \(\mathbf R_{\mathbf{XX}}=\mathbf U\boldsymbol\Lambda\mathbf U\herm\). Then \(\mathbf R_{\mathbf{ZZ}}=\boldsymbol\Lambda\) and the normal equations fall apart into scalars:

In the eigenbasis \[w'_k=\frac{r'_{k}}{\lambda_k},\qquad \sigma_E^2=\sigma_Y^2-\sum_k\frac{\abs{r'_{k}}^2}{\lambda_k},\qquad r'_k=\E{Z_kY\conj}=\mathbf u_k\herm\mathbf r_{\mathbf{XY}}.\]

One \(N\times N\) solve becomes \(N\) scalar problems: whiten first, then estimate coordinate by coordinate.

The same estimate, one eigenface at a time

The eigenvectors \(\mathbf u_k\) of \(\mathbf C_{\mathbf{XX}}\) are eigenfaces of the left half. A new left half is read off as coordinates \(z_k=\mathbf u_k\herm(\mathbf x-\mathbf m_{\mathbf X})\); each eigenface has a right-half partner \(\mathbf w'_k\). Recombine: \(\widehat{\mathbf y}=\mathbf m_{\mathbf Y}+\sum_k z_k\,\mathbf w'_k\).

Top row: the first five left eigenfaces with this face's coordinates. Bottom row: their right-half partners. Middle: the size of the coordinates of a held-out face. Right: the recombined right half with 1, 5, 20 and 100 terms, the ridge estimate, and the truth.

On the 80 held-out photos the error falls to 42% of the variance with 100 terms, then rises to 65% with all 319: the last terms divide by tiny \(\lambda_k\).

Where it goes wrong

Left: the strength of each eigen-direction and its overlap with the target. Right: the resulting weights, without and with ridge regularization.

Direction 6 holds half a percent of the data’s energy and barely overlaps the target, yet without regularization it gets the largest weight: the estimator amplifies whatever noise lies along it.

Ridge: lift the small eigenvalues

Solve \((\mathbf R_{\mathbf{XX}}+\delta\mathbf I)\mathbf w=\mathbf r_{\mathbf{XY}}\) instead. The eigenvectors stay; every eigenvalue is lifted by \(\delta\):

Ridge \[\widetilde w'_k=\frac{r'_k}{\lambda_k+\delta}=w'_k\cdot\frac{\lambda_k}{\lambda_k+\delta}:\] strong directions untouched, weak ones switched off rather than inverted.

With the moments known, ridge is strictly worse. It earns its place when they are estimated: dividing by a small \(\lambda_k\) amplifies the error in measuring \(r'_k\).

The eigenvalue spread \(\lambda_{\max}/\lambda_{\min}\) says how badly the solve is conditioned, and it is a property of the data, not of the algorithm.

A richer list of observations

Nested subspaces

Two projections \(\underbrace{\mathbf w\herm\mathbf X+w_0}_{\text{affine: }\widehat Y_{\text{aff}}}\quad\subset\quad \underbrace{g(\mathbf X)}_{\text{all functions: }\E{Y\mid\mathbf X}}\)

Projection onto a dictionary Between the two: the span of \(\Psi_k=\psi_k(\mathbf X)\), including \(1\) and the \(X_k\): \[\begin{gathered}\widehat Y_\psi=\sum_k w_k\conj\Psi_k,\qquad \sum_l\E{\Psi_k\Psi_l\conj}\,w_l=\E{\Psi_kY\conj},\\ \E{\abs{Y-\E{Y\mid\mathbf X}}^2}\le\E{\abs{Y-\widehat Y_\psi}^2}\le\E{\abs{Y-\widehat Y_{\text{aff}}}^2}.\end{gathered}\]

The larger set needs the whole joint law; the smaller one, four moments.

Linear in the weights, not in the data

Example: a projectile’s height \(Y\) against the time \(t\) of the reading, with the dictionary \(1, t, t^2, \dots\).

A projectile's height readings against the time of the reading.

The best affine estimate of the height is flat.

One more dictionary entry, t squared, recovers the arch.

The error against the number of dictionary entries.

A symmetric arch has no linear part: the affine estimator sees nothing. Enrich the dictionary and the projection climbs to the conditional mean.

Toward deep learning: a learned dictionary

A multilayer perceptron (MLP) is a dictionary expansion whose entries are themselves fitted: \[\mathbf h^{(0)}=\mathbf X,\qquad \mathbf h^{(\ell)}=\sigma\big(\mathbf A_\ell\mathbf h^{(\ell-1)}+\mathbf b_\ell\big),\qquad \widehat Y=\mathbf w\herm\mathbf h^{(L)}+w_0 .\]

An MLP: inputs X, hidden layers of sigmoid units whose last layer is the dictionary psi(X), and linear output weights w into the estimate Y-hat. The hidden layers are learned by gradient descent; with them fixed, w solves the normal equations.

Freeze the hidden layers and the output weights are this week’s projection. Deep learning also fits the dictionary: the problem stops being linear in the weights, and gradient descent replaces one solve.

When linear is already optimal

The Gaussian theorem

Gaussian estimation If \((Y,\mathbf X)\) are jointly Gaussian, the conditional mean is affine, \[\E{Y\mid\mathbf X}=m_Y+\mathbf c_{\mathbf{XY}}\herm\mathbf C_{\mathbf{XX}}^{-1}(\mathbf X-\mathbf m_{\mathbf X}),\] so the affine estimator is the best estimator of any kind.

Jointly Gaussian pairs at two correlations: the conditional mean is a straight line, with a band of one conditional standard deviation.

The proof is three lines, and one of them matters

Proof Let \(E=Y-\widehat Y\) be the error of the affine estimator.

  1. \(E\) is affine in \((Y,\mathbf X)\), so \((E,\mathbf X)\) is jointly Gaussian.
  1. Orthogonality makes \(E\) uncorrelated with \(\mathbf X\), and \(\E{E}=0\).
  1. For jointly Gaussian variables, uncorrelated implies independent.

So \(\E{E\mid\mathbf X}=\E{E}=0\), and \(\E{Y\mid\mathbf X}=\widehat Y+\E{E\mid\mathbf X}=\widehat Y\).

Step 3 is the only one that uses Gaussianity. Without it the error is still uncorrelated with the data, but uncorrelated no longer means unpredictable.

What step 3 buys

Left: jointly Gaussian, where the conditional mean is the line the linear estimator finds. Right: uncorrelated but dependent, where the linear estimator sees nothing.

This is why second-order theory carries signal processing: Gaussian noise makes the linear answer the right answer. And where the data are not Gaussian, the covariance can miss everything.

From data instead of moments

When the moments are unknown

\(\mathbf R_{\mathbf{XX}}\) and \(\mathbf r_{\mathbf{XY}}\) are never known. What we hold is \(L\) training pairs \((\mathbf x_i,y_i)\). Two problems, two averages:

Population and empirical risk \[\text{MMSE: }\min_{\mathbf w}\E{\abs{Y-\mathbf w\herm\mathbf X}^2},\quad \text{least squares: }\min_{\mathbf w}\frac1L\sum_{i=1}^L\abs{y_i-\mathbf w\herm\mathbf x_i}^2 .\]

Only the average differs: least-squares normal equations \[\widehat{\mathbf R}_{\mathbf{XX}}\,\mathbf w=\widehat{\mathbf r}_{\mathbf{XY}},\qquad \widehat{\mathbf R}_{\mathbf{XX}}=\frac1L\sum_i\mathbf x_i\mathbf x_i\herm=\frac{\mathbf A\herm\mathbf A}{L},\qquad \widehat{\mathbf r}_{\mathbf{XY}}=\frac{\mathbf A\herm\mathbf y}{L},\] with the design matrix \(\mathbf A\) holding one training input \(\mathbf x_i\herm\) per row, \(\mathbf y\) the targets.

Least squares is MMSE computed with sample moments; the two meet as \(L\to\infty\).

A fit is an estimator

The data follow \(y=\phi_1+\phi_2x+n\) with noise uncorrelated with \(x\), so \(\phi_1+\phi_2x\) is the LMMSE line; the least-squares fit of each sample estimates it.

One sample of 25 points with the LMMSE line and its least-squares fit; fits from 80 independent samples; the two fitted coefficients as a random vector with its covariance ellipse.

The fitted coefficients are a random vector, centered on the truth here, with a covariance ellipse of their own: the error bars of a curve fit.

Training and inference

A supervised data set holds \(L\) pairs \((\mathbf x_i,y_i)\): inputs, each with the target it came with.

Training

  1. Estimate the moments: \[\begin{gathered}\widehat{\mathbf R}_{\mathbf{XX}}=\tfrac1L\textstyle\sum_i\mathbf x_i\mathbf x_i\herm,\\ \widehat{\mathbf r}_{\mathbf{XY}}=\tfrac1L\textstyle\sum_i\mathbf x_i\,y_i\conj .\end{gathered}\]
  2. Solve: \(\widehat{\mathbf R}_{\mathbf{XX}}\,\mathbf w=\widehat{\mathbf r}_{\mathbf{XY}}\).

Inference

A new input \(\mathbf x\) arrives, without its target. Predict \[\widehat y=\mathbf w\herm\mathbf x .\]

The pairs are used once, to fix \(\mathbf w\); inference needs only \(\mathbf w\). What counts is the error on new inputs, not on the training pairs.

System identification

When the data obey a model, the fit is the system

Suppose the outputs really are a matrix applied to the inputs, plus noise uncorrelated with them: \[\mathbf Y=\mathbf A_0\mathbf X+\mathbf N\quad\Longrightarrow\quad \mathbf R_{\mathbf{YX}}=\mathbf A_0\mathbf R_{\mathbf{XX}} .\]

Signal flow: the input X observed, the matrix A_0 sought, noise N random and added at the output, the output Y observed.

System identification The normal equations \(\mathbf A\,\mathbf R_{\mathbf{XX}}=\mathbf R_{\mathbf{YX}}\) return \(\mathbf A=\mathbf A_0\): the best linear estimator of the output from the input is the system.

From \(K\) pairs, \(\widehat{\mathbf A}=\widehat{\mathbf R}_{\mathbf{YX}}\widehat{\mathbf R}_{\mathbf{XX}}^{-1}\), each row with error covariance \((\sigma_N^2/K)\,\widehat{\mathbf R}_{\mathbf{XX}}^{-1}\): the inputs you choose decide what you learn.

Identifying a rotation

A known point cloud \(\mathbf x_k\in\Real^2\) is turned by an unknown matrix and every point is measured with noise, \(\mathbf y_k=\mathbf A_0\mathbf x_k+\mathbf n_k\). The fit \(\widehat{\mathbf A}=\widehat{\mathbf R}_{\mathbf{YX}}\widehat{\mathbf R}_{\mathbf{XX}}^{-1}\) is never told that \(\mathbf A_0\) is a rotation.

28 noisy points recover the rotation to a fraction of a degree.

Left: a known F-shaped point cloud and its rotated, noisy measurement. Right: the fitted matrix applied to the cloud lands on the measurements.

A guitar amp, linear in the weights

The amp saturates (\(f\)), the cabinet filters (\(g\)). With \(f=\sum_p\phi_p\psi_p\) in Legendre polynomials the output is linear in \(c_{p\ell}=\phi_p\,g[\ell]\):

A guitar signal through an amp's saturation f and cabinet g, plus noise; the model expands f in fixed functions psi_p, weights them by phi_p and filters by g.

\[Y[k]=\sum_{p=1}^{9}\sum_{\ell=0}^{31}c_{p\ell}\,\psi_p\big(X[k-\ell]\big)+N[k]\qquad\text{288 regressors, one set of normal equations.}\]

→ Demo: identify a guitar amp

One observation at a time

The innovation

Innovation The part of \(X_i\) its predecessors could not predict linearly: \[W_i=X_i-\widehat X_i,\qquad\widehat X_i=\text{projection of }X_i\text{ onto }\mathrm{span}\set{X_1,\dots,X_{i-1}} .\]

Row \(i\) holds the predictor \(\widehat X_i=\sum_{j<i}a_{ij}X_j\) of \(X_i\) from its past: \[\begin{bmatrix}W_1\\W_2\\W_3\\W_4\end{bmatrix}= \begin{bmatrix}1&&&\\-a_{21}&1&&\\-a_{31}&-a_{32}&1&\\-a_{41}&-a_{42}&-a_{43}&1\end{bmatrix} \begin{bmatrix}X_1\\X_2\\X_3\\X_4\end{bmatrix}\]

\(W_i\perp X_j\) for every \(j<i\), so the innovations are mutually uncorrelated.

Innovations are Cholesky

The matrix of predictors is lower triangular with unit diagonal; call it \(\mathbf L^{-1}\):

Innovations are the Cholesky factorization \[\mathbf W=\mathbf L^{-1}\mathbf X,\qquad \mathbf R_{\mathbf{XX}}=\mathbf L\mathbf D\mathbf L\herm,\qquad \mathbf D=\diag\paren{\E{\abs{W_i}^2}} .\]

\(\mathbf D^{-1/2}\mathbf L^{-1}\) is the Cholesky whitener of the random-vector week: computing the factor and running all the predictors are the same act.

“Past” was only an ordering. Nothing assumed the index means time: the construction applies to any ordered set of variables with known correlations.

What one more observation buys

Append \(X_{N+1}\). Its innovation \(W\) is the one new direction it adds to the span:

The error drops by exactly \[\Delta J=\frac{\abs{\E{Y\,W\conj}}^2}{\E{\abs W^2}}\ \ge\ 0 .\]

More data never hurts. It fails to help only if \(W=0\) (nothing new) or \(W\perp Y\) (new but irrelevant).

For \(N\) sensors of the same target with independent noise, each new sensor adds less than the one before: the error falls like \(1/N\), and the gains are front-loaded.

Scanning an image

Read a \(64\times64\) portrait row by row and predict each pixel from the \(65\) pixels scanned just before it, with correlations from the other \(399\) faces.

A portrait scanned row by row with dotted jumps back to the start of each row; each pixel predicted from its scanned past; the innovations, which are near zero except at edges.

The innovation keeps 3% of the image’s power, and it sits at the edges: the eyes, the nostrils, the outline of the face.

One equation, many readings

reading the observations the Gram matrix the result
linear MMSE random variables \(X_k\) \(\E{X_kX_l\conj}\) the best linear estimate
richer dictionary functions \(\psi_k(\mathbf X)\) \(\E{\Psi_k\Psi_l\conj}\) closer to \(\E{Y\mid\mathbf X}\)
Gaussian as above as above equal to \(\E{Y\mid\mathbf X}\)
least squares \(L\) data points \(\frac1L\mathbf A\herm\mathbf A\) MMSE with sample moments
identification known inputs \(\mathbf x_k\) \(\frac1K\sum_k\mathbf x_k\mathbf x_k\herm\) the system \(\mathbf A_0\) itself
in sequence innovations \(W_k\) diagonal \(\mathbf D\) Cholesky; one new direction per sample

Only the inner product and the set of observations change. The right angle does not.

Recap

This week

  1. Minimizing the mean-square error is dropping a perpendicular. The error is orthogonal to every observation, which gives the normal equations \(\mathbf R_{\mathbf{XX}}\mathbf w=\mathbf r_{\mathbf{XY}}\): second moments are all it takes, and \(\mathbf R_{\mathbf{XX}}^{-1}\) corrects for what the observations share.
  1. The same equation reads many ways: on a richer dictionary it approaches the conditional mean; for Gaussian data it is the conditional mean; with sample moments it is least squares; on data from a linear system it returns the system; in sequence it produces uncorrelated innovations, which is Cholesky.
  1. The error covariance \(\mathbf C_{\mathbf{EE}}\) is known before the data arrive, and small eigenvalues are where estimates break: ridge lifts them.