Linear algebra
A machine-learning question may describe a dataset as a matrix, a prediction as a dot product, and fitting as a projection. These lessons connect those terms to calculations you can do with three records and two input features.
| Record | Study hours | Practice sets | Observed score |
|---|---|---|---|
| 1 | 1 | 0 | 2 |
| 2 | 2 | 1 | 5 |
| 3 | 3 | 1 | 8 |
These are invented records for arithmetic, not evidence about study habits. We will use them to predict scores and then examine why our chosen model cannot match every score exactly.
- A record becomes a vector — Read an ordered list, identify its entries, and compare two records.
- Multiply matching entries, then add — Combine features with weights and distinguish the dot product from vector length.
- Make every prediction at once — Check matrix shapes and trace an output entry to the numbers that produced it.
- Which outputs can the model reach? — Read columns as available directions and determine whether an exact solution exists.
- Find the closest allowed prediction — Define “closest” using squared error and derive a projection onto a line.
- Fit the weights by least squares — Calculate fitted weights and check that the residual is perpendicular to both feature columns.
You need arithmetic and simple equations to begin. The derivation of least squares uses perpendicularity, so no calculus is required here. Afterwards, work through another dataset to connect these calculations with model evaluation.
Use the reference for formulas and conditions, or practice choosing the next step.