CS109: Probability for Computer Scientists
Spring 2017
Monday, Wednesday, Friday 10:30am to 11:50am in NVIDIA Auditorium


Lecture Videos
Staff / Office Hours
icon Piazza
Course Reader
icon Socrative


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


Tuesday, May 9th
Hewlett 200

Tuesday, June 13th
Skilling and Nvidia Aud

Teaching Team



Chris Piech
Gates 193
Wed 1-3pm

Class Playlist

Just for fun: Here is a public playlist where we can share music amongst our class (it uses, Spotify): https://open.spotify.com/user/1251835474/playlist/5JDismsK1CH2YLMRZcqUvc. I'll add a few songs that I play before class. You can add music that you like and of course feel free to checkout each other's music. Sharing music is completely optional and is independent of your grade.

CS109 Contest

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

MLE for Regression

Here is a khan style explanation that shows how you the linear regression algorithm can be derived using MLE:

PSet #5

The penultimate problem set is now availible. The problem set includes problems such as understanding the probability of survival on the titanic, evaluating peer grading, a/b testing.


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.

Friday Update

A few notes before the weekend. The midterm review session was today and was recorded. See the video link if you couldn't make it in person. I just released the practice midterm solution. I strongly recommend that you don't look at the solutions until you have seriously attempted the problems -- it is much harder to identify a correct solution than to generate one.

I'm in the process of combining my lecture notes into a topic driven format (where notes are composed based on concept, not lecture). You are free to use the work in progress: Course Reader. It is very rough at the moment -- I expect to update it by Sunday morning.

I made a minor update to problem 10 on PSet 4. I had previously emitted that you should assume that your prior belief that the email was written by user A is 0.5 (and thus your prior belief that the email was written by user B is also 0.5).

PSet 4: Joint Variables

Pset #4 is out. It uses real probability distributions from the IPCC Climate Change report and has you implement biometric keystroke identification.

Midterm Review

The CS109 Midterm is coming up (it is going to be 7pm, next Tuesday in Hewlett 200). To prepare we have posted solutions to the first two problem sets (see the Problem Sets tab). We have added a practice midterm and we will share solutions on Friday. Sometimes students want even more practice! So we posted extra problems (see the Resources tab).

The midterm is two hours long. It will be open notes, closed computer. It will cover concepts up until today's lecture (May 3rd), all problem sets 1 through 3 and many problems from problem set 4. See the problem set 4 splash page for an explination of which problems from it are fair game.

We are going to hold a Midterm Review session this Friday (May 5th) in Skilling Auditorium from 12:30-1:20pm. It will be recorded.

PSet 3: Random Variables

Pset #3 is out. It has one programming problem that asks you to predict elections based off of polling data. We made a small change to problem 11, the bloom filter, on April 25th to make it a more narative driven problem :-).

Prototype Section

Want to practice more probability in a smaller setting with TAs. In theory it will be a chance for us to solve problems together in a way that is more guided than office hours and more involved than lecture. Come, ask see what it is about! : Gates 104. : Tomorrow, Thursday 4/19 from 1:30p to 2:20p.

Binomial Gaussian

In class on Monday we talked about how Binomial distributions and Galton boards. Here is the video:

PSet #2

Problem set #2 is out! A few of the problems require you to process data. The datasets are now availible.

Update: We slightly updated the wording in problem 3 to make it clear that you can assume that two movies are conditionally independent given that the user does not like the genre.

Submit PSet #1

Problem set #1 is due on Friday. Submit your assignment by uploading it to the CS109 gradescope page. Gradescope is a tool that we will use to electronically grade and give you feedback on your problem sets. If you want to manually sign up, our class code is: MY6WP9.

Python Tutorial

There will be a Python tutorial led by Head TA William Monroe Thursday (4/13) from 4:30pm-5:20pm in Gates B01.

PSet #1

PSet #1 has been released! Office hours will start tomorrow -- see the office hour calendar for times and locations. There were a few clarifications to problems added on the morning of April 6th. See the errata on the pset for more details.


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

Former CS109 student Joe Delgado has written a nunber of snippets for Latex in Sublime, which he has made available on github.

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 April 3rd at 10:30am in NVIDIA Auditorium.