CS 189/289A

CS 189/289A at UC Berkeley


This class introduces algorithms for learning, which constitute an important part of artificial intelligence.

Topics include:

  • classification: perceptrons, support vector machines (SVMs), Gaussian discriminant analysis (including linear discriminant analysis, LDA, and quadratic discriminant analysis, QDA), logistic regression, decision trees, neural networks, convolutional neural networks, boosting, nearest neighbor search;
  • regression: least-squares linear regression, logistic regression, polynomial regression, ridge regression, Lasso;
  • density estimation: maximum likelihood estimation (MLE);
  • dimensionality reduction: principal components analysis (PCA), random projection; and
  • clustering: k-means clustering, hierarchical clustering, spectral graph clustering.


  • Math 53 (or another vector calculus course)
  • Math 54, Math 110, or EE 16A+16B (or another linear algebra course)
  • CS 70, EECS 126, or Stat 134 (or another probability course).
  • Enough programming experience to be able to debug complicated programs without much help. (Unlike in a lower-division programming course, the Teaching Assistants are under no obligation to look at your code.)

You should take these prerequisites quite seriously. If you don't have a solid intuitive understanding of linear algebra, probability, and gradients, as well as substantial programming experience with some attention to data structures, I strongly recommend not taking CS 189. However, the prerequisites are not formally enforced—rather, they're enforced by the fact that you won't understand the class without them.

If you want to brush up on prerequisite material, see the Resources section for some suggestions.


The grading breakdown is as follows:

  • 40% for homeworks.
  • 20% for the Midterm.
  • CS 189: 40% for the Final Exam.
  • CS 289A: 20% for the Final Exam.
  • CS 289A: 20% for a Project.

Grade bins are set at the beginning of the semester, but will not be publicized. This class is not curved — in other words, your grade does not depend in any way on how well your peers do. You are encouraged to help each other study and better understand the material!


The Midterm might take place on Wednesday, March 16 at 6:30–8:00 PM, but is subject to change. (We will announce a finalized date/time as soon as possible)

The Final Exam will take place on Friday, May 13 from 3:00-6:00 PM.

Unfortunately, we will not be able to offer any alternate exams, so please make sure you do not have any exam conflicts with other classes.


  • Piazza will be used for announcements, general questions and discussions, clarifications about assignments, student questions to each other, and so on. If you have an administrative question, you are encouraged to make a private Piazza post instead of emailing us directly. You can join the Piazza here.
  • Gradescope will be used to collect and grade assignments. If you are a UC Berkeley student enrolled or waitlisted in the course, you should have been added automatically to Gradescope. If not, please make a private post on Piazza ASAP so we can make sure you were enrolled in the class properly.
  • bCourses will be used to post HW and discussion worksheet solutions. Only enrolled and waitlisted UC Berkeley students will have access to this.


Lectures will typically come with supplemental reading from one or both of the textbooks below. While these readings are not strictly required, we highly recommend doing them in order to fully understand the material. Both textbooks are available free online; hardcover and eTextbook versions are also available.


Aside from lectures, the following resources are available to all students enrolled or waitlisted in the class:

  • Piazza for asking questions about course material, assignments, or logistical issues
  • Discussion Sections (schedule here), which are weekly 1-hour sections led by TAs focused on problem solving. Discussions will consist of both lecture concepts and new material.
  • Office Hours (schedule here) for getting help with conceptual or homework questions

If you want to brush up on prerequisite material:

  • Here's a short summary of math for machine learning written by our former TA Garrett Thomas.
  • Stanford's machine learning class provides additional reviews of linear algebra and probability theory.
  • There's a fantastic collection of linear algebra visualizations on YouTube by 3Blue1Brown starting with this playlist, The Essence of Linear Algebra. I highly recommend them, even if you think you already understand linear algebra. It's not enough to know how to work with matrix algebra equations; it's equally important to have a geometric intuition for what it all means.
  • To learn matrix calculus (which will rear its head first in Homework 2), check out the first two chapters of The Matrix Cookbook.
  • Another locally written review of linear algebra appears in this book by Prof. Laurent El Ghaoui.
  • An alternative guide to CS 189 material (if you're looking for a second set of lecture notes besides mine), written by our former TAs Soroush Nasiriany and Garrett Thomas, is available at this link. I recommend reading my notes first, but reading the same material presented a different way can help you firm up your understanding.


There will be a total of 7 homework assignments, most of which will involve a combination of math and coding. Below are tentative due dates; each homework will be released immediately after the previous one is due.

  • Homework 1 is due Wednesday, January 26 at 11:59 PM.
  • Homework 2 is due Wednesday, February 9 at 11:59 PM.
  • Homework 3 is due Wednesday, February 23 at 11:59 PM.
  • Homework 4 is due Wednesday, March 9 at 11:59 PM.
  • Homework 5 is due Wednesday, March 30 at 11:59 PM.
  • Homework 6 is due Wednesday, April 20 at 11:59 PM.
  • Homework 7 is due Wednesday, May 4 at 11:59 PM.


  • Discussion of HW problems is encouraged. Showing other students small amounts of code for debugging purposes is okay. However, all work, including programming, must be written individually.
  • Remember to cite any sources you used and provide a list of other students you worked with on the homework.
  • We will actively check for plagiarism.
  • The typical penalty for any kind of cheating is a large NEGATIVE score, but we reserve the right to give an instant F for even one violation, and will always give an F for two.

Late Policy

You will receive 5 slip days total, which can be used to submit assignments late without penalty. Please budget them carefully — they are meant to be used primarily for emergency purposes, such as illnesses or technical issues during submission. We will generally not grant extensions for such issues, as you are expected to use your slip days instead.

  • Granularity is in days, so any submissions past 12am will use an entire slip day.
  • Late submissions receive zero credit if you do not have any slip days left to use.
  • We will apply your slip days optimally at the end of the semester to maximize your homework grade.
  • If you are in the Disabled Students' Program and you are offered an extension, even with your extension plus slip days combined, no single assignment can be extended more than 5 days.