Back to index
OtherOne quarter, around 30 lectures·Free

Stanford CS109: Probability for Computer Scientists

4.4

Probability taught the way a programmer wants to learn it, with simulations and code alongside the maths. Less rigorous than a statistics department course, and considerably more likely to be finished.

What We Liked

  • Every concept is paired with runnable code, which makes abstractions concrete fast
  • Course reader and notes are well written and freely available
  • Ends by connecting probability directly to machine learning rather than leaving the link implicit
  • Chris Piech is a genuinely good lecturer with a light touch
  • Assumes programming ability instead of assuming mathematical maturity

What Could Be Better

  • Materials availability varies by year and old offerings sometimes disappear
  • Less rigorous than a proper probability course, with proofs frequently gestured at
  • Video availability has been inconsistent, so some cohorts are notes only
  • Problem sets and exams are not always released with solutions
  • Covers less ground than STAT 110 in the same time

Detailed review

CS109 exists because computer science students kept taking probability courses designed for mathematicians and coming out able to pass the exam but unable to use any of it. Stanford's answer was to rebuild the subject around the assumption that the student can write a program, and it works better than I expected. The framing is simple: if you can simulate it, you can understand it. Want to know what a binomial distribution is? Write the loop.

Want to see the central limit theorem? Sample from something ugly ten thousand times and look at the histogram. Want to understand why Bayes rule gives that counterintuitive answer on the medical test problem? Simulate a million patients. This is not a gimmick, it is a genuinely different epistemology for learning probability, and for people who trust code more than they trust algebra it removes an enormous amount of friction. The syllabus runs through counting, conditional probability and independence, random variables, the standard distributions, joint distributions and covariance, the central limit theorem, parameter estimation with maximum likelihood and MAP, and then, and this is the part I appreciate most, it turns directly into machine learning.

Naive Bayes, logistic regression and basic neural networks are presented as applied probability rather than as separate topics, which is exactly the right way round and is how almost nobody teaches it. A student finishing CS109 understands why logistic regression has the loss function it has, which is more than most people who have used it for years can say. Chris Piech has taught it for several years and the course reader he maintains is excellent, clearly written, well organised, and free. The problem sets involve real code and real datasets.

There is a section on inference and bootstrapping that is more practically useful than anything I have seen at the same level. The frustrations are logistical more than pedagogical. Stanford course pages get rebuilt each year and older offerings sometimes vanish or lose their video links, so what you can access depends on when you look. Video coverage has been inconsistent across years, and some offerings leave you with notes and slides only.

Solutions to problem sets are not reliably public, which weakens self study since you cannot check yourself. If you want a guaranteed complete package, STAT 110 is the safer choice. On rigour, be clear about the trade. CS109 will give you working fluency and good intuition.

It will not give you the tight formal grounding of a mathematics department course, and there are places where a result is asserted and simulated rather than proved. For most machine learning work that is fine. If you intend to read theory papers or do research, you will eventually need the harder version, and STAT 110 or a proper measure theoretic course is where that comes from. My four point four reflects a course that solves a real problem well, teaching probability to people who think in code, discounted for inconsistent material availability and for a level of rigour that is deliberately lighter than the subject can support.

Take it first, enjoy it, and then decide whether you need to go deeper.

[ final ]

The verdict.

The right first probability course for someone who codes and wants the material to feel useful immediately. Follow it with STAT 110 if you plan to read papers.