Linear Algebra & Calculus for ML
Express data and models as vectors and matrices in NumPy, decompose matrices to expose their structure, and use derivatives and the chain rule to explain how models are optimized.
5 objectives 6 steps about 135 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Represent a dataset and a linear model as matrix-vector operations in NumPy, predicting result shapes before running the code.
- Compute dot products, norms, distances and cosine similarity and explain what each measures between feature vectors.
- Compute partial derivatives of a composed function with the chain rule and verify them with a numerical gradient check.
- Implement gradient descent for linear regression and explain how learning rate and feature scale affect convergence.
- Use eigendecomposition and the singular value decomposition to find a matrix's dominant directions, and build a truncated-SVD low-rank approximation whose reconstruction error you can explain by rank.
Lesson plan
6 steps, about 135 min · 5 of 5 lessons available so far
- Data as Arrays: Vectors, Matrices and Shapes Concept · 20 min
- Similarity and Structure: Distances, Eigenvectors and the SVD Concept · 30 min
- From Slopes to Gradients: Derivatives, the Chain Rule and Jacobians Concept · 25 min
- Worked Example: Checking a Gradient Numerically Worked example · 15 min
- Lab: Fit a Linear Model with Hand-Written Gradient Descent Lab · 30 min
- Check: Shapes, Gradients and Step Sizes Knowledge check · 10 questions
Practise it
In pure NumPy, fit linear regression on a real dataset with both the closed-form solution (solved, not inverted) and gradient descent, match scikit-learn's coefficients to four decimals, and plot loss curves for three learning rates with and without feature scaling; then compress an image or ratings matrix with truncated SVD and plot reconstruction error against rank.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own Neural NetworkIntermediate · 6–12 h
- Build your own Deep Learning FrameworkAdvanced · 20–40 h
References
Hard prerequisites
None.
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.