• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 11 pages
Exam (elaborations)

CS229 Machine Learning Study Guide | Stanford ML Exam Prep PDF

Document preview thumbnail
Preview 2 out of 11 pages

Master Stanford's CS229 Machine Learning with this comprehensive intermediate-level study guide PDF. Perfect for college students preparing for ML exams, this digital download covers all four core pillars of Stanford's renowned CS229 course: supervised learning, learning theory, unsupervised learning, and neural networks.

Content preview

CS229 Machine Learning — Study Guide 1




CS229 Machine Learning
Study Guide
Intermediate Level • Stanford CS229 Core Topics




This guide consolidates the four core pillars of Stanford’s CS229: supervised learning, learning
theory, unsupervised learning, and neural networks. It assumes comfort with linear algebra
(matrix operations, eigendecomposition), multivariable calculus (gradients, Hessians), and basic
probability (Gaussians, Bayes’ rule). Each section ends with a practice problem; complete
solutions are provided in the final section so you can attempt each problem before checking your
work. Read actively — re-derive every gradient and re-sketch every model.


Contents

1 Linear Regression & Least Squares 2

2 Logistic Regression & Generalized Linear Models 3

3 Generative Models: GDA & Naive Bayes 4

4 Support Vector Machines & Kernels 4

5 Learning Theory 5

6 Unsupervised Learning 6

7 Neural Networks & Backpropagation 7

8 Solutions to Practice Problems 9

9 Summary & Further Reading 11

, CS229 Machine Learning — Study Guide 2



1. Linear Regression & Least Squares

Linear regression is the foundation of supervised learning: predict a real-valued output y ∈ R
as a linear function of features x ∈ Rn. The hypothesis is
n
Σ
hθ(x) = θ ⊤x = θjxj,
j=0

where we append a bias feature x0 = 1. Given a training set {(x(i), y(i))}mi=1 , we choose θ to
minimize the squared-error cost
m
1Σ 2
J(θ) = hθ (x(i)) − y(i) .
2
i=1


Gradient descent updates θj := θj − α ∂J∂θ,j where for a single example

∂J
= h θ(x) − y xj .
∂θj

This is the LMS (least-mean-squares) update. The update is proportional to the error (hθ(x)−y),
which gives the algorithm its self-correcting character.
Batch gradient descent sums the gradient over all m examples; stochastic gradient descent
(SGD) updates after each example, which is cheaper and often faster on large datasets. The
learning rate α controls step size — too small and convergence is slow; too large and the cost
may diverge.
The normal equations give the closed-form minimizer. Stacking the data into a design matrix
⊤
X ∈ Rm×(n+1) (rows are x(i) ) and label vector y ∈ Rm, the optimal θ satisfies

∇θJ = X⊤(Xθ − y) = 0 =⇒ θ = (X⊤X)−1X⊤y.

This is the maximum-likelihood estimator under Gaussian noise y(i) | x(i) ∼ N (θ⊤x(i), σ2).
Key formula: normal equations



Closed-form least-squares solution. Requires X⊤X to be invertible (features linearly inde-


Worked mini-example. Two points: (x, y) = (1, 2), (2, 4), with bias feature. Then X =
1 1 2 3 5 −3
, y = 24 . Compute X⊤X = , X⊤y = 610 . Inverse of X⊤X is (det
1 2 3 5 −3 2
5·6−3·10
= 1), giving θ = −3·6+2·10 = 20 . So the line is h(x) = 0 + 2x = 2x, exactly fitting both points.

Practice Problem 1


{(1, 3), (2, 5), (3, 7)}. Compute the least-squares parameter vector θ (θ0, θ1) using the
normal equations. Verify that the residuals are zero.

Document information

Uploaded on
November 4, 2026
Number of pages
11
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Lectgrayson
3.9
(18)
Sold
155
Followers
5
Items
2585
Last sold
2 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions