CS229 / STUDY NOTES
Independent graduate study edition · Spring 2026

Machine learning: from regression to reasoning

Follow the recordings, rebuild the mathematics, and test the ideas. These notes use the lecture transcripts as their organizing spine, then add explicit definitions, worked examples, research connections, and exercises with solutions.

17recording-based chapters
20.6 hsource recordings
64,169approximate words
85exercises with solutions
How to read

Begin with the chapter, follow its timestamp links when an argument needs context, then solve the exercises before opening the solutions. The study guide connects prerequisites and suggests research projects. Mathematics renders offline; recording and paper links require internet access.

The lecture sequence

17 chapters shown

Lecture 01What is being learned?

A property-research assistant is asked to estimate a house's price, identify comparable sales, summarize the neighborhood, and decide whether another document would improve its answer. These requests sound like one application, yet they require different learning problems. Predicting price needs a target and a loss. Finding comparable properties needs a representation and a similarity rule. Choosing another search needs a policy that trades information against cost. This chapter uses that assistant to make the course's organizing distinctions precise.

36 min recording · 3,668 words · Exercises with solutions
Lecture 02Linear regression as prediction, geometry, and computation

A house-price predictor can fit yesterday's sales precisely and still misprice tomorrow's houses. It can also make stable predictions while its individual coefficients vary wildly. Linear regression is a small enough laboratory to separate these failures: representation determines which predictions are possible, the loss determines what counts as error, and the optimizer determines which coefficients computation actually returns.

78 min recording · 4,989 words · Exercises with solutions
Lecture 03From noise models to logistic regression and Newton steps

A property model must answer two different questions: “What price will this house sell for?” and “Will an inspection reveal a serious defect?” A numerical price and a binary event require different observation models. Maximum likelihood provides a common construction: describe a distribution for the observations, evaluate how well it explains the data, and optimize its parameters. The resulting loss is determined by the model, rather than selected because its graph looks convenient.

62 min recording · 4,105 words · Exercises with solutions
Lecture 04Exponential families, generalized linear models, and softmax

A property service predicts a sale price, the probability of a defect, the number of maintenance requests, and one of several property types. Writing an unrelated learning algorithm for each output would hide their common structure. Exponential families explain why different observation models can share a gradient rule while retaining different means, variances, and support. Softmax then turns the same construction into the multiclass output layer used throughout modern machine learning.

74 min recording · 4,170 words · Exercises with solutions
Lecture 05Generative classification, Gaussian geometry, and naive Bayes

Research extensions are identified through links to primary papers; numerical examples and executable checks are original teaching constructions.

81 min recording · 4,072 words · Exercises with solutions
Lecture 06Bias, variance, regularization, and model selection

Suppose our property service predicts repair cost from a standardized measurement $x$. A straight line may miss real curvature. A high-degree polynomial may pass through every observed cost yet make unstable predictions on new properties. The question is not merely which function fits one dataset. It is how the entire learning procedure behaves when the data are sampled again.

78 min recording · 3,940 words · Exercises with solutions
Lecture 07Neural networks as compositions of learned representations

Research extensions are identified through links to primary papers; numerical examples and executable checks are original teaching constructions.

80 min recording · 3,826 words · Exercises with solutions
Lecture 08Backpropagation, computational graphs, and higher-order derivatives

Research extensions are identified through links to primary papers; numerical examples and executable checks are original teaching constructions.

62 min recording · 3,738 words · Exercises with solutions
Lecture 09Clustering, Gaussian mixtures, and the geometry of lower bounds

The property service has a large archive of sensor measurements but only a small number of labeled inspections. It wants to explore recurring patterns before deciding what to label. Clustering can organize observations, but it cannot supply the missing meaning by itself. A mathematical objective must first say what counts as a coherent group.

76 min recording · 3,949 words · Exercises with solutions
Lecture 10Expectation–maximization and principal component analysis

The property archive presents two different kinds of hidden structure. Measurements may come from several overlapping populations, suggesting a mixture model. Alternatively, many sensors may respond to a few common factors, suggesting a low-dimensional subspace. Expectation–maximization and principal component analysis address these structures through different objectives.

80 min recording · 3,859 words · Exercises with solutions
Lecture 11Diffusion models: forward noise, reverse dynamics, and a trajectory ELBO

Suppose the property service wants a model of inspection images, rather than a classifier of predefined defects. The statistical objective is to learn a distribution from which new images can be sampled. A diffusion model approaches this by defining an easy corruption process and learning many small reverse transitions.

82 min recording · 3,598 words · Exercises with solutions
Lecture 12Learning to denoise, then learning to adapt

A property-inspection service has two scarce resources: clean examples of unusual damage and labeled examples of the decisions an inspector must make. A generative model can learn a distribution of images, while a representation model can turn images into features for a downstream decision. These are different statistical tasks. Success at generating plausible cracks does not establish that a classifier detects dangerous cracks.

75 min recording · 3,428 words · Exercises with solutions
Lecture 13Contrastive representations, semantic search, and grounded generation

An inspector asks, “Which earlier reports describe a horizontal foundation crack?” The archive contains photographs, repair invoices, inspection reports, and documents about unrelated cosmetic cracks. A keyword match may miss a paraphrase; a visually similar photograph may depict the wrong defect. We need a learned notion of relevance, an efficient way to search it, and an answer that remains accountable to the retrieved evidence.

60 min recording · 3,361 words · Exercises with solutions
Lecture 14Autoregressive language models and the mechanics of attention

The inspection assistant has retrieved the right report. It must now produce an answer token by token, preserve a negation such as “no structural movement,” and relate a measurement to the correct building. What probability model generates this sequence, and what computation allows a token to use the relevant earlier passage?

77 min recording · 3,355 words · Exercises with solutions
Lecture 16Efficient transformers and the difference between prompting and training

The inspection assistant works for one user, but stalls when many users submit long reports. Adding more expert parameters may improve its language model while making deployment harder. Meanwhile, a few examples in a prompt can alter its behavior without changing a single weight. These observations concern different resources and different meanings of adaptation.

73 min recording · 3,432 words · Exercises with solutions
Lecture 18Markov decisions, Bellman equations, and policy gradients

An inspection robot must reach a damaged wall, collect a useful image, and return without wasting its battery. Moving closer to the wall may look good immediately, yet a barrier can make a temporary detour the best action. The assistant controlling the robot receives outcomes, not a label specifying the optimal move at every instant.

76 min recording · 3,150 words · Exercises with solutions
Lecture 20Credit assignment, PPO, and reinforcement learning for language models

The inspection assistant can generate several candidate answers to a report question. Some correctly compute a crack-width change; others produce plausible but unsupported conclusions. We can score the final result more easily than prescribe every intermediate token. How should those scores change the model, and how much can we reuse answers generated before the latest parameter update?

78 min recording · 3,529 words · Exercises with solutions

Coverage and provenance

All 17 available playlist recordings are represented. The upload sequence jumps from lecture 14 to 16, then 18 and 20; recordings 15, 17 and 19 are absent. Several upload titles disagree with the spoken content. The source map preserves original titles alongside transcript-derived chapter titles.

Full available English caption tracks were acquired. The section ledger records review depth for each chapter. All 17 chapters were rewritten after sequential review of the available caption text. These are technical study chapters, not line-by-line accounts. Visual slides and board work were not comprehensively inspected, so the notes do not claim visual transcription.

Original examples and independently reconstructed mathematics are distinguished from recorded discussion. Historical benchmark claims are kept in their research context. Read the recording and section map for the precise source boundary.

Independent teaching contributions include explicit notation, worked cases, research extensions, and traceable references. Official course site · Supplied playlist