CS109: Probability for Computer Scientists
Autumn 2017
Monday, Wednesday, Friday 3:30pm to 4:20pm in Hewlett 200


Staff / Office Hours
icon Piazza
Course Reader


Problem Set 1
Problem Set 2
Problem Set 3
Problem Set 4
Problem Set 5
Problem Set 6


Thursday, Nov 2nd
Based on last name

Thursday, Dec 14th
Hewlett 200

Teaching Team



Chris Piech
Gates 193
Thursday 1-3pm

Final Exam

The CS109 final is coming up: it is next Thursday (Dec 14th) from 3:30 to 6:30pm in Hewlett 200 (our normal classroom). The final is open notes, open book, closed calculator.

The best way to study is with the Practice Final. Here are Solutions to the practice final.

Final PSet

The final problem set is now availible. You will derive update equations for a simple deep learning architecture and will implement two machine learning algorithms, Naive Bayes and Logistic Regression. You will then use these algorithms to make predictions on Heart tomography, Netflix movies and Ancestry.

Linear Regression Lite

Here is a khan style explanation of the last example from the Monday (Nov 13th) class. It shows how a one parameter version of the linear regression algorithm can be derived using MLE. For a written verion, which also includes the gradient ascent code, see the lecture handout from Monday.

CS109 Contest

This quarter we are going to hold the second ever Stanford Probability for Computer Scientists Contest. The contest is completely optional. See the contest handout for more details.

PSet #5

The penultimate problem set is now availible. The problem set includes problems such as evaluating peer grading, a/b testing and an origin story for beta distributions on assignment grades.

Old Announcements

Midterm Distribution

The midterm solutions are now availible. If you have any questions about how to solve these problems, go talk to a TA or Chris. We would love to explain how to approach these (and similar) problems. You can also see the full statistics.

Midterm on Thursday

The CS109 midterm is coming up: it is next Thursday (Nov 2nd) from 7 to 9pm. The midterm is open notes, open book, closed calculator. The location of your midterm is based on your last name:
A - K: Hewlett 201
L - S: 260-113
T - Z: 300-300

The best way to study is with the Practice Midterm. Solutions to the practice will be released on Monday. On Monday after class (4:30p) in Hewlett 201 we are going to hold a midterm review session. Notes from the session will be published.

Problem Set 4

PSet #4 has been released! It has you predict users based on biometric keystrokes. The pset clearly delineates the questions that you should do before the midterm :-).

Problem Set 3

PSet #3 has been released! It uses real probability density functions from the IPCC Climate Change report, has you predict elections and analyze a bloom filter (a probabilistic datastructure).

Galton Board

A Galton board is a physical Binomial distribution where the bucket index that a ball falls into R ~ Bin(n,p) where n is the number of levels and p is the probability of going right each time the ball hits a pin. Check out the JavaScript demo, and the cool video bellow:

Python Tutorial (2/2)

There will be a second and final optional Python tutorial led by TA Yuling Liu, Friday (Oct 6th) from 4:30pm-5:20pm in 370-370. If you missed the first review session, you can catch up by reading Yuling's awesome notes.

In this section we are going to go over Python libraries that are useful for probability. Again, python is not required for CS109. However a few problems in the psets require coding and seeing as Python is the language of computer science for probability, its worth learning.

Join Gradescope

Our gradescope page is live! The entry code is MP5GG5.

If you're new to Gradescope, you can join the class by going to https://gradescope.com/ and clicking the button in the top right marked "Sign Up for Free." Select "Student," then enter the entry code, your full name, email address, and 8 digit student id.

If you have any questions, feel free to post on Piazza.

Sign up for Section!

Please sign up for section by filling out this form:

Once a week you are going to meet in a small group section. We are going to find the best weekly time for everyone. Section sign ups will close on Saturday at 11:59pm. Preferences are not first come first serve.

PSet #1 is out

PSet #1 has been released! It is due next Firday, Oct 6th at 3:00pm. Submission will be via gradescore. Further submission instructions will come out next week. Office hours will start tomorrow -- see the office hour calendar for times and locations.

You can optionally write up your problem sets using LaTex. See this intro to LaTex, and the LaTex code used to generate it. Though you may install LaTeX, it is often much easier to use an online LaTeX editor. Two good options are: overleaf.com and sharelatex.com.

Python Tutorial

There will be an optional Python tutorial led by TA Yuling Liu, Friday (Sept 29th) from 4:30pm-5:20pm in 370-370. This will be the first of a two part series which will get you caught up to python in case you have never used it before. Python is not required for CS109. However a few problems in the psets require coding and seeing as Python is the language of computer science for probability, its worth learning. We will record the session.

NYT Article on Stats

An article from the New York Times discusses the increasing importance of statistics in computing. The article is entitled For Today's Graduate, Just One Word: Statistics. On a similar vein, The Wall Street Journal published an article entitled New Hiring Formula Values Math Pros talking about how employers are seeking computer scientists with training in statistics and probability. CS109 is specifically mentioned.

What is CS109?

We put together some handouts to help you understand where we are going to go in CS109 and how we plan to get there. See the Administrivia handout for details on logistics.

The Course Schedule page shows you the topics that we are going to cover in CS109 and the corresponding readings. We will also post materials from lecture on the schedule page.


Welcome to CS109! We are looking forward to a fun quarter. Class starts Monday Sept 25th at 3:30pm in Hewlett 200.