Course Description

CS 181 provides a broad and rigorous introduction to the principles of machine learning, probabilistic reasoning and decision making in uncertain environments. We will discuss the motivations behind common machine learning algorithms, and the properties that determine whether or not they will work well for a particular task. You will derive the mathematical underpinnings for many common methods, as well as apply machine learning to challenges with real data. In doing so, our goal is that you gain a strong, conceptual understanding of machine learning methods that can empower you to pursue future theoretical and practical directions.

How CS181 fits with other ML/AI courses

The goal of CS 181 is to combine mathematical derivation and coding assignments to provide a strong and rigorous conceptual grounding in the principles of machine learning (e.g. being able to reason about how different methods should behave in different circumstances). Students interested primarily in theory may prefer Stat195, CS184, and other learning theory offerings. Students interested primarily in implementation and practice may prefer CS109a and other data science offerings. There are also a number of undergraduate and graduate courses in the CS[1,2]8* AI umbrella for dives into specific topics and applications.


The material is aimed at an advanced undergraduate level. Students should be comfortable with writing non-trivial programs (e.g. any course, experience, or willing to self-study beyond CS50). All staff-provided scaffolding code will be in Python. Students should also have a background in probability theory (e.g. STAT 110 or equivalent), and familiarity with calculus and linear algebra (e.g. AM22a, Math 21b, or equivalent).

Motivated students without all of these prerequisites may also be able to fill in gaps in their knowledge. Part I of the textbook Math for Machine Learning is a useful resource for mathematical background (specifically Sections 2.1-2.6; 3.1-3.5; 4.1-4.2; 5.1-5.6; 6.3). Homework zero due January 26 is also a good indicator of your preparedness and what gaps you may need to fill.

Course Logistics

Team The CS181 team consists of the course instructors---Finale Doshi Velez and David Alvarez-Melis---as well as a large staff of TFs lead by two co-head TFs---Charu Badrinath and Alex Cai. We are all dedicated to helping you to learn the fundamentals of machine learning.

Lecture, Section, Office Hours

All learning will be in-person. In terms of lessons learned from the thick of the pandemic, please be thoughtful of your peers and the course staff by masking if you are feeling mildly ill or have been exposed to people that are ill. If you need to stay home, section notes will be available through the course schedule and the lectures will follow the course notes.

Lectures Lectures will be used to introduce new content as well as explore the content through conceptual questions. Students are highly encouraged to ask questions during lecture -- let us appreciate being live and in-person in ways that we didn't before the pandemic! The instructors will linger for a few brief questions after lecture; more in-depth questions can be addressed at office hours.

Sections Sections will employ a flipped classroom format, in which students will work on questions that will be good preparation for homework and the midterms. The teaching staff will introduce the questions, assist students in solving them, and wrap up with the solutions. These solutions will be posted. The section cycle “restarts” each Tuesday after lecture, when a new section begins. Each week’s section covers the previous week's Thursday lecture and this week's Tuesday lecture.

Office Hours Most office hours will be in person; one set will be over zoom. See the schedule page for information. Please make use of them!

Materials and Resources

Textbook There is no official textbook for the course. There is a set of course notes available here. These notes come from an awesome effort of a past CS181 student who decided to create a course textbook as an (unusually and awesomely ambitious!) senior thesis, and several years of students and staffs who have volunteered time to fix bugs and improve clarity. If you find bugs, please be a good citizen and put in a pull request.

Course Website The course web site will be used for posting section notes and links to assignments, and includes pointers to other resources we'll use, including Ed and GradeScope.

Gradescope Gradescope will be used for submitting assignments and posting grades.

Ed Ed. Most communications with the course staff should go via Ed rather than email. In particular, the Ed site for the course will be used for three purposes:

  • Content questions are technical questions posted to the teaching staff and other students. (Please keep in mind collaboration policies when asking about code or solutions.)
  • Clarification questions are posts to the teaching staff about logistical details (Is there really class on XYZ holiday or is that a mistake?) or questions about homework phrasing or typos (Should question 1a of the homework be asking for the integral of x, not y?). We will make every effort to respond to these questions as quickly as possible. Tag these questions as "clarification."
  • Private Message These may include procedural things such as requests for additional time on midterms or additional late days; you may also have other concerns that you wish to share. Most such procedural requests should come this way. (Note: Regrade requests go directly to Gradescope.)

Ed is not a formally secure, private, or confidential form of communication, and what you send may be seen by the entire course staff. If you have a sensitive concern, please also directly email the instructor with CS181: in the subject line.

Requirements and Grading

The main grading components of the course are homework zero (4%), six homework assignments (11% each), and two midterms (15% each, in March and April). If you do not complete homework zero, the course staff will contact you to discuss your participation in the course. Participation in section, office hours, Ed, and lecture may be used to bump up a grade that for a student who ends up near a letter-grade boundary. Similarly, any bonus component of the course, such as an exceptionally creative practical solution, will only be a factor for students on grade boundaries.

Grading errors. If you believe there has been a grading error, submit a regrade request through GradeScope. However, please note that a) we will regrade the entire assignment, which may result in your total grade going up or down, and b) we will only allow one regrade request per problem set.


The homework assignments help you practice the core concepts that we cover in the course. They involve components that are theoretical and conceptual and also require some programming. Homework solutions must be submitted in LaTeX and will be returned with grades and solutions. Due to the volume of the grading, it may not always be possible for the staff to provide detailed feedback. It is your responsibility to look at the solutions, identify gaps, and come to office hours to fill in those gaps.

Submission Policy Homeworks will be submitted on Gradescope. You will submit a pdf of your LaTeX'd work, your original tex source, and your code. The staff will only assess your work using the pdf---they will not be running your code, or looking at your notebooks. Make sure that all relevant plots and numbers are in your write-up! The tex source and code will be used to adjudicate possible Honor Code violations (see below) and other exceptional circumstances.

Collaboration Policy You may work with others, but your write-up must be entirely written by yourself in your own words. You may help each other debug code, but again, the code must be written by you. Include the names of anyone you worked with in your write-up. It is an honor code violation to copy parts of another person's assignment (includes text and code) or jointly type up an assignment. You can make use of textbooks and online sources to help in answering questions, but you must cite your sources (and you should be ready to explain your answer to a member of the teaching staff). It is an honor code violation to look up solutions to the specific questions that we ask from the internet or other sources (e.g. friends from previous years).

Generative AI Policy We recognize that generative AI can be a powerful tool, and we want you to figure out how to use it in ways that are benefit you. Any generative AI tools should be treated as collaborators. That is, your write-up and code must be entirely written by yourself. You must disclose if and how you have used generative AI in your homeworks. You must take full responsibility for anything you submit and must be able to explain your solutions without any aid from peers or tools.

Late Days Policy Late Days Policy. Homework should be submitted electronically by midnight on the due date, via the Gradescope course website. This is a strict deadline, enforced by the site, so submit early enough that you don't accidentally discover that your local clock is slow. You have six late days that can be used for homework assignments. Up to two late days can be used on any assignment. Start early and plan ahead! The staff will give 50% credit to assignments turned in past their late days. It is always in your interest to turn in a partial or very late homework rather than not turning in any homework at all. It is an honor code violation to look at the solutions if you haven't yet turned in your assignment.

Sickness (and other Life Events) Policy In general, we expect you to use your late days first---the whole point is that you can use them for anything, no questions asked. At the same time, we understand that sometimes life throws a set of circumstances that impact your performance in the course beyond what the late day policy can address. Should this become a problem for you, please let the instructor know, via email, so that we can help determine a plan to navigate a tough situation (again, CS181: in the subject line). If you find that you have used up all your late days, for example, and have more illness, then please reach out to us. We may ask you to start a correspondence with your resident dean to verify their support of your extra needs (doctor's notes are not necessary; we will discuss solely with your resident dean).


Midterms are a chance to demonstrate what you have learned. Midterms will be closed-book and in-person, during class. You will be allowed to bring one sheet of 8.5x11 paper of notes (front and back, any font), and to the extent possible, we will also provide you with what we think you need to be able to answer the question without needing to memorize too many things. It is an honor code violation to communicate with anyone about the midterm while you take the midterm, and to communicate in any way with other students. You should also be careful not to share information about the midterm with any students who need to take a midterm at a different time due to conflicts with other midterms.

Illness If you have an acute illness at the time of a midterm, then you must let the instructor know in advance of the midterm, get a doctor's note (this is one case where we would like a note) and send it to us as soon as possible. We will likely also follow up with your resident dean and determine the best way to handle the situation.


The goal of the course is to instill a strong technical background about the core principles of machine learning. These principles will provide a foundation for you to dive more deeply into the theory of existing methods and the creation of new methods, if you wish; they will also provide you with core understanding to robustly, successfully, and responsibly apply machine learning in the world. In addition to derivations and programming components, each class will include some illustrations and discussion of real world applications of machine learning. There will also be a lecture that is devoted to the ethical implications of machine learning as part of the Embedded EthiCS program, and each homework will have elements that require you to go beyond the maths.

Given the the increasing use of machine learning systems, the users and developers of these systems must hold themselves to high professional and ethical standards. One can cause real harm by pursuing a good cause via poor engineering choices. Quoting one of our favorite superheroes: with great power (to run any kind of analysis) comes great responsibility (to do it properly)!

Relatedly, we expect all participants in this course---instructors, teaching staff, and students---to be committed to an open, professional, and inclusive environment. We want everyone to be comfortable in the course and empowered to learn. These qualities take cultivation and effort. We welcome constructive feedback to improving the course environment and want you to reach out to the instructors, or members of the teaching staff, with any concerns.