Linear algebra reference
Objects and shapes
Section titled “Objects and shapes”Use for records and for features. Our example has and .
| Expression | Meaning | Shape or type |
|---|---|---|
| Feature measurements for record , as a column | ||
| Feature of record | Scalar | |
| Inputs, with record stored in row | ||
| One weight per feature | ||
| Observed outputs | ||
| One prediction per record | ||
| Rows and columns exchanged | ||
| Residuals: observed minus predicted |
These shapes use the convention that feature vectors are columns. A dataset row is therefore .
Operations
Section titled “Operations”The dot product returns one number. The squared Euclidean norm adds squared entries. Both depend on the chosen coordinate scales.
Check the inner dimensions, then take each left-hand row dotted with each right-hand column. Matrix multiplication is not entry-by-entry multiplication, and changing order can change the answer or make a product undefined.
Reachable outputs
Section titled “Reachable outputs”If are the columns of , then
The column space contains all these linear combinations. has an exact solution precisely when belongs to it. Independent columns give unique coefficients for every reachable output. Rank counts independent column directions.
Closest outputs under squared error
Section titled “Closest outputs under squared error”For a nonzero vector , the projection onto its span is
For several columns, least-squares weights satisfy
The fitted prediction is unique; the weights are unique if the columns are independent. Writing requires that independence. Solving the normal equations does not require explicitly forming an inverse.
For our example:
An intercept requires a constant input column. Minimizing training error is a fitting calculation; assessing new-data performance is a separate step.