CS109: Probability for Computer Scientists
Autumn 2018
Monday, Wednesday, Friday 1:30pm to 2:50pm in 420-040

This is the website for the CS109 offering from Fall 2018. To access the course for Spr 2019, please go to this course page.


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


Tuesday, Oct 30th
Dinkelspiel Aud.

Wednesday, Dec 12th

Teaching Team



Chris Piech
Gates 202
Thursday 1:30-3:30pm

Contest Results

We received 21 contest entries this quarter and were impressed by the creativity and probability know-how the entries showed.

Winner: Shannon Yan, Monte Carlo Tree Search for Tic Tac Toe.

Finalist: Avanika Narayan, Predicting Revenue for SaaS Companies.

Finalist: Anirudh Jain, Bayesian Networks for Melanoma Genes.

Final Exam

The CS109 final is coming up: it is next Wednesday (Dec 12th) from 3:30 to 6:30pm in CEMEX Auditorium. The final is open notes, open book, closed calculator.

The best way to study is with the practice exams.

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.

Smoke Day

Because of smoke from the Camp Fire, all classes and sections were cancelled for Nov 16th. For students with section on Friday, we will have a makeup section after the break. You can read the lecture notes for Naive Bayes to help you get started on the last pset. On the Monday after Thanksgiving we will resume class where we last left off (just about to get into Machine Learning with Naive Bayes, Logistic Regression and Deep Learning).

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.

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.

Central Limit Theorem

In class we chatted about how if $Y$ is the sum of $n$ iid random variables (which all have expectation $\mu$ and variance $\sigma^2$) then:

$Y \sim N(n\mu, \frac{\sigma^2}{n})$

The proof is beyond the scope of the class. A friendly CS109 student from last quarter (Sophia Furfine) made a video of the proof in case you are curious!

Midterm next Tuesday

The CS109 midterm is coming up: it is next Tuesday (Oct 30th) from 7 to 9pm in Dinkelspiel Auditorium. The midterm is open notes, open book, closed calculator.

The best way to study is by working through the practice exams and section problems. On Saturday at 12:30 pm we are going to hold a midterm review session in 420-040. Notes from the session will be published.

TAs will also be hosting extra office hours and conceptual office hours from now until the midterm. Check out the office hours page for times, locations, and the specific focus for each particular OH. Some OH will be focusing specifically on conceptual questions in preparation for the midterm, and all OH will prioritize homework problems "above the line" from problem set 4 over those "below the line".

OAE and alternate midterm assignments (request here by Friday at 1 pm) will be finalized in the coming days; look out for an email with your specific logistics. Email Julia (jdaniel7) if you requested an alternate midterm and haven't received your information by Monday.

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). On Tuesday (Oct/16) it was updated with some minor changes.

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:

Problem Set 2

PSet #2 has been released! Calculate the updated belief of the locaiton of a cell phone and hypothesize the genetic relationship between bats and whether they carry Ebola.

VPTL Tutoring

Stanford offers a free tutoring service for CS109 students called VPTL tutoring! It is ideal if you want to ask about a question/topic/problem in more detail than we have time for in OH. Book appointments here.

Join Gradescope

For pset submission in CS109 we are using gradescope. The entry code is MK3EGN.

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.

Once you have a Gradescope account, click "Enroll in Course" button on the bottom right and enter our course code.

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.

Python tutorial friday

There will be an optional Python tutorial Friday (Sept 28th) in Gates 104. Two of our wonderful TAs are hosting two separate sessions (both will cover the same material) one session is 10am - 11am the other is from 3pm - 4pm. 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 post notes from the session.

PSet #1 is out

PSet #1 has been released! It is due next Firday, Oct 5th at 1:00pm. Submission will be via gradescore. Further submission instructions will come out next week. Office hours will start tomorrow, and the office hour calendar will have 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. A great option is: overleaf.com.


Welcome to CS109! We are looking forward to a fun quarter. Class starts Monday Sept 24th at 1:30pm in 420-040.

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.

The Administrivia handout has details on course logistics. Read this to get a sense for what CS109 is going to entail.

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.

The Staff / Office Hour page has contact information for TAs and the office hour calendar. Office hours will start this Thursday.