The Math Behind Machine Learning
Source: Concepts adapted from Ace the Data Science Interview — Chapter 7 (“Machine Learning”) by Kevin Huo & Nick Singh. Rewritten in original wording for this course.
Probability and stats show up constantly in DS interviews. Full linear-algebra and multivariable-calculus proofs are rarer — unless you are interviewing for research scientist or quant finance, where whiteboarding least squares, PCA, or related derivations is fair game. Even then, interviewers sometimes hide the math inside a product story (e.g. “what drives portfolio factor returns?” → PCA).
For everyone else: you still want the basics. They unlock why PCA, regression, and neural-net training work the way they do. This lesson covers that foundation — linear algebra, gradient descent, evaluation / selection, bias–variance, overfitting, regularization, interpretability — then how models are actually trained: cross-validation, bootstrapping / bagging, hyperparameter search, and learning curves. Concept quizzes, slider explorers (same FormulaExplorer pattern as Statistics), numeric drills, labs, and coding after each core topic.
Linear algebra
The linear-algebra topic that comes up most often is eigenvalues and eigenvectors. For an matrix , a nonzero vector is an eigenvector with eigenvalue when:
Geometrically, is a linear map. On an eigenvector it only scales (same direction, factor ).
Writing a square matrix in terms of its eigenvectors is an eigendecomposition. Not every matrix is square; non-square matrices use singular value decomposition (SVD):
with (), (), and ().
ML uses this toolkit constantly: matrix multiplies in backprop, eigendecomposition of a covariance matrix in PCA, projections, inverses, determinants, orthonormal bases, and diagonalization. Research / quant loops may ask you to whiteboard follow-ups on PCA or linear regression from these building blocks.
Linear algebra for ML
1 / 5x is an eigenvector of A when…
Pick an answer to see if you are right.
Compute: eigenvalues
1 / 5Let A = [[5, 0], [0, 2]] and x = [1, 0]. If Ax = λx, what is the eigenvalue λ for this eigenvector? Round to 2 decimals.
Enter a number (at most 2 decimal places).
Gradient descent
Training minimizes an objective (loss / cost): how badly the model fits the data. Lower is better. Optimization methods search for good parameters.
Gradient descent repeatedly steps opposite the gradient — the direction of steepest increase — so each step goes “downhill”: