O'Reilly logo
live online training icon Live Online training

Probability with Python: Essential Math for Data Science

Understand the fundamentals of random events

Topic: Data
Thomas Nield

Many applied and sciences require strong foundation in probability. Join expert Thomas Nield to solidify your grounding in probability concepts such as important distributions, Bayes's theorem, and conditional expectation. Along the way, you’ll learn how the different probability distributions are related and connected to each other and how to use Python’s stats- and probability-oriented libraries.

This is the third course in a four-part series focused on essential math topics. These courses are grouped in pairs with this natural progression:

  1. Linear Algebra with Python
  2. Linear Regression with Python


  1. Probability with Python
  2. Statistics and Hypothesis Testing with Python

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • How probability works and what it means to measure randomness
  • How multiple events can affect the probability of another event
  • How to use discrete and normal distributions
  • When to add and multiply probabilities of different events

And you’ll be able to:

  • Recognize situations where Bayes’s theorem applies
  • Leverage Python to create continuous and distributions

This training course is for you because...

  • You’re a budding data science professional who wants to build foundational knowledge in probability before diving into statistics and machine learning.
  • You’re a programmer using data science and machine learning libraries and want to understand the math and probability principles behind them.
  • You want to see what Bayes’s theorem is all about.


  • A computer with Python 3 and NumPy installed
  • A working knowledge of Python (e.g., variables, functions, loops, generators, and classes)
  • A basic understanding of mathematical functions, logarithms, and exponents

Recommended preparation:

Recommended follow-up:

About your instructor

  • Thomas Nield is an operations research consultant as well as a writer, conference speaker, and trainer. He enjoys making technical content relatable and relevant to those unfamiliar or intimidated by it. Thomas regularly teaches classes on analytics, machine learning, and mathematical optimization. He’s authored two books, including Getting Started with SQL (O'Reilly) and Learning RxJava (Packt), and has written several popular articles, including “How It Feels to Learn Data Science in 2019” and “Is Deep Learning Already Hitting Its Limitations?”


The timeframes are only estimates and may vary according to how the class is progressing

Getting started (10 minutes)

  • Group discussion: The Monty Hall problem
  • Presentation: What is probability?

Understanding probability (10 minutes)

  • Presentation: Frequentist and Bayesian probability; odds ratios
  • Hands-on exercise: Want to make a bet?

Adding and multiplying probabilities (15 minutes)

  • Presentation: Joint probability (AND); union probability (OR)
  • Hands-on exercises: Rain and joint probability; rain and union probability

Conditional probability (10 minutes)

  • Presentation: Conditional probability and colorblindness
  • Hands-on exercise: Rain and conditional probability

Break (10 minutes)

Bayes’s theorem (20 minutes)

  • Presentation: Violence and video games
  • Hands-on exercise: Medical testing accuracy

Binomial distribution (10 minutes)

  • Presentation: Binomial distribution
  • Hands-on exercise: Airline empty seats

Normal distribution (15 minutes)

  • Presentation: Normal distribution; quantile functions
  • Hands-on exercise: Predicting the life expectancy of a phone

Beta distribution (15 minutes)

  • Presentation: Beta distribution and probability of probabilities
  • Hands-on exercise: Unfair coin flip

Wrap-up and Q&A (5 minutes)

  • Presentation: Other distributions (Poisson, exponential)