Probability for Data Science

About the author

Stanley H. Chan

Stanley H. ChanProfessor of Electrical and Computer Engineering, Purdue University

Google Scholar Twitter LinkedIn YouTube

Friends and visitors, I am Stanley Chan. I am a Professor at Purdue University, West Lafayette, United States. My area is Electrical Engineering. I teach, advise students, and run a research group on computational imaging, where we build intelligent cameras that can see in the hard conditions from near-darkness to turbulent air.

I teach probability and machine learning frequently at Purdue, and this book grew straight out of that classroom. If it helps you, or if you catch a mistake, I'd genuinely love to hear from you.

Why a free textbook?

This book is free for everyone around the world.

You may download a free PDF copy from the download page. If you want a hard copy, you can purchase one from the publisher at a discounted price to cover the printing cost.

Some people ask how much money I make from this book. The answer is zero — not a single penny goes to my pocket. Why? Textbooks today are just ridiculously expensive, and I want to slow down the trend. Education should be accessible to as many people as possible, especially to those from underprivileged families. To accomplish this, I have minimized all expensive editorial and marketing services — so I need your help to promote the book, and to tell me if you spot an editorial error.

College textbook prices have risen 812% since 1978
Source: NBC News, 2015

Why another probability textbook?

As I wrote this book, I did a fairly exhaustive search of the available textbooks on the subject. From the tsunami of data science books, there are essentially two categories.

The first type are written for programmers. They emphasize processing data by calling standard or customized libraries for various statistical tasks. Theories are explained at a high level — a reference point rather than a deep dive. These books matter, but many people, especially college students, need more solid mathematical training to solve harder problems.

The other type are classical probability textbooks written for mathematicians. While mathematically rigorous, most students are not interested in reading them page by page. Why? They can be boring — it is easy to get lost in the theorems, and the theorems are not directly connected to practical engineering problems. As a faculty member at Purdue, I heard these comments time and again:

Between the two ends of this spectrum lies a gap. We need a book that balances theory and practice — one that provides insights, not just theorems and proofs; that motivates students by telling them why probability is essential to their work; and that highlights the impact of the subject. I put the book in the context of data science to emphasize the inseparability of data (computing) and probability (theory) in our time.

Unique features of this book

What people say

This is one of the best introductory books on probability that I have seen. It is rigorous, yet intuitive. It is full of beautiful illustrations and easy-to-understand code samples (Python, Matlab, R, Julia). Before introducing each new theoretical concept, the author gives reasons for why the material is important in practice, thus providing motivation for learning it. The title focuses on “Data Science” but in fact this book could be used to provide a thorough introduction to probability for any STEM student.
Google DeepMind
Introduction to Probability for Data Science is the rare textbook that presents probability as a way of thinking that students carry into machine learning and artificial intelligence. The second edition is a substantial improvement, with a clearer exposition, a wealth of new exercises and solutions, and integrated code that helps students move between theory and computation. What stands out most is the book’s clarity. It develops difficult ideas patiently and intuitively without sacrificing rigor. This is an excellent first course for aspiring data scientists, and a book I’m happy to recommend to my own students.
University of Wisconsin at Madison
An exceptionally accessible introduction to probability, with a strong emphasis on the concepts and tools most relevant to modern data science. The companion e-book, code, and slides make learning both engaging and practical.
Yale University
Probability theory is a cornerstone of science and technology, and is especially important for data science. This exceptionally ambitious and vividly illustrated textbook approaches the subject from a distinct perspective. It not only presents the core probability concepts that are typically covered in the undergraduate engineering curriculum, but it also ventures into some advanced topics that are increasingly relevant to modern applications but rarely found outside of graduate-level texts. The book is also filled with beautifully illustrated examples that make sophisticated material more tangible and help build intuition, with many of these based on common practical situations that arise in real-world data science applications. A motivated student will be able to get themselves a very long way with this book.
University of Southern California
As AI moves faster, a real command of probability has become more important, not less. Professor Stanley Chan has written the book I would want all my own students to learn from: mathematically serious, exceptionally intuitive, and consistently connected to how modern data analysis actually works.
The University of Texas at Austin
This book doesn’t just show how to solve problems; it explains the principles and intuition to demystify probability and reveal design choices.
Georgia Institute of Technology
This is an excellent textbook for undergraduate EE and CS students, with thorough coverage of a wide range of topics, including fundamentals such as probability spaces, random variables, and sample statistics, as well as more applied problems such as regression, estimation, and hypothesis testing. New concepts are introduced with clear, intuitive explanations, followed by more rigorous theory. The book is beautifully illustrated with numerous diagrams, plots, and other visual illustrations, and the frequent computational examples play a valuable role in connecting theory and practice. It is also worth noting that the author has made this book available at no cost, despite the enormous effort that was clearly dedicated to writing it.
Los Alamos National Laboratory
Stanley Chan is a gifted educator with a rare ability to reveal the intuition behind mathematical ideas without sacrificing rigor. Introduction to Probability for Data Science reflects that gift throughout, connecting probability to computation, machine learning, and real-world problems in a way that helps students understand not only how the mathematics works, but why it matters.
Georgia Institute of Technology
A refreshingly clear bridge between theory and practice — Chan’s book shows exactly why probability is the bedrock of data science, pairing sharp intuition with the rigor students will draw on throughout their careers.
University of California at Riverside
Probability is one of the most fear-inducing subjects for undergraduates interested in data science. This newly revised textbook lets students conquer that fear through a systematic approach, leveraging notes, exercises, and useful video examples to demystify the topic and build a strong mathematical foundation to launch further investigations and careers in data science.
Arizona State University