TL;DR
- Scalar product ; norm ; βΊ orthogonal. Distance of to the hyperplane : .
- Data matrix : one data point per row. = all predictions ; is a combination of data points.
- Rank = number of independent rows/columns. A square matrix is invertible iff it has full rank. : .
- Eigenvalues: . Symmetric matrices have real eigenvalues and orthogonal eigenvectors: . PSD: all βΊ ; and are always PSD.
- Projection: . Trace = sum of the diagonal = sum of the eigenvalues; ; the trace of a projection is its rank.
Source of the definitions: the courseβs mathematical appendix. Everything below is in .
Vectors, scalar product, norms
Scalar product and norms
- .
- Euclidean norm (the length). norm (lasso). βnormβ = number of non-zero entries (sparsity).
- For unit vectors, . βΊ .
- Cauchy-Schwarz: .
Example: , : , , .
Hyperplanes. is a line (in ) or plane through the origin, with normal vector . A linear classifier predicts : which side of the hyperplane lies on. The signed distance of a labeled point is (L2).
Memory aid
measures βhow much points in direction β. Divide by to get a true distance. Scaling does not change the classifier, only the number .
Matrices
Matrix products
, : (row of times column of ). Rules: ; in general .
The data matrix. has the data points as rows. Then
- : all predictions of the linear model at once.
- : a linear combination of the data points. This is why gradient descent on least squares stays in the span of the data (L8).
- holds all scalar products (a kernel matrix); is times the empirical covariance (for centered data).
Mini example
: (, ). .
Rank, inverse, linear systems
Rank and inverse
- Rank = maximal number of linearly independent columns = rows = dimension of the image .
- is invertible () iff it has full rank iff iff no eigenvalue is 0.
- : .
Example: .
Kernel (null space) and range
- : directions the data βdoes not seeβ. : the span of the data points.
- Every splits uniquely as with , , and (so , Pythagoras).
Linear systems ( equations, unknowns):
- , full column rank: usually no exact solution; least squares (L5).
- , full row rank: infinitely many solutions , ; the one with the smallest norm is (L8).
Memory aid
Tall matrix (more points than dimensions): too many equations, fit as well as possible. Wide matrix (more dimensions than points): too few equations, pick the shortest solution. : exactly one solution, but fragile (the interpolation threshold).
Eigenvalues and eigenvectors
Eigenvalue
is an eigenvector of with eigenvalue if : in direction , only stretches by the factor . The eigenvalues are the roots of .
by hand
: , eigenvectors and . Shortcut for : , .
Symmetric matrices ( )
Real eigenvalues, orthonormal eigenvectors, and the spectral decomposition
Functions act on the eigenvalues: has eigenvalues , has .
Where it appears: GD on least squares converges iff all , i.e. (L8); ridge shrinks the directions with small eigenvalues most (L5); the covariance spectrum decides benign overfitting (L8).
Positive (semi-)definite
Symmetric is positive semi-definite (PSD) if all eigenvalues are , equivalently for all , equivalently for some . Positive definite: , invertible. and are always PSD, because ; is positive definite for , which is why ridge always has a unique solution.
Memory aid
Eigenvalues are the stretch factors of in its own natural axes. Invertible = no stretch factor is 0. PSD = no direction gets flipped.
SVD and the generalized inverse
Singular value decomposition
Every is with orthogonal , and a diagonal with the singular values . The non-zero are the non-zero eigenvalues of both and .
Generalized (Moore-Penrose) inverse
For symmetric : : invert where possible, leave the null space alone. if is invertible; . Least squares in general: (L5).
Projections and the trace
Projection
is a projection if (projecting twice changes nothing); orthogonal if additionally . Example: projects onto the span of the data points: it keeps and kills (L8).
Trace
. Cyclic: . A number is its own trace: . Trace of a projection = its rank. .
The trace trick (used in the proofs of L8)
For a random vector with and a fixed matrix : . With this gives the variance term of the minimum norm interpolator (L8).
Self-check
Question cards (5)
Compute the inverse of .
Answer
: .
Eigenvalues of and the largest step size for which GD on converges?
Answer
4 and 1 (diagonal entries). GD needs , so .
has 3 rows and 10 columns, full rank. How many solutions does have, and what is ?
Answer
Infinitely many; rank 3, so .
Why is positive semi-definite?
Answer
for every .
What is the trace of the projection for of rank ?
Answer
: cyclic trace gives .