# Foundations of Probability in Python

Learn fundamental probability concepts like random variables, mean and variance, probability distributions, and conditional probabilities.

Start Course for Free5 Hours16 Videos61 Exercises

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?Try DataCamp For Business

## Loved by learners at thousands of companies

## Course Description

Probability is the study of regularities that emerge in the outcomes of random experiments. In this course, you'll learn about fundamental probability concepts like random variables (starting with the classic coin flip example) and how to calculate mean and variance, probability distributions, and conditional probability. We'll also explore two very important results in probability: the law of large numbers and the central limit theorem. Since probability is at the core of data science and machine learning, these concepts will help you understand and apply models more robustly. Chances are everywhere, and the study of probability will change the way you see the world. Let’s get random!

For Business

### Training 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more- 1
### Let's start flipping coins

**Free**A coin flip is the classic example of a random experiment. The possible outcomes are heads or tails. This type of experiment, known as a Bernoulli or binomial trial, allows us to study problems with two possible outcomes, like “yes” or “no” and “vote” or “no vote.” This chapter introduces Bernoulli experiments, binomial distributions to model multiple Bernoulli trials, and probability simulations with the scipy library.

Let’s flip a coin in Python50 xpFlipping coins100 xpUsing binom to flip even more coins100 xpProbability mass and distribution functions50 xpPredicting the probability of defects100 xpPredicting employment status100 xpPredicting burglary conviction rate100 xpExpected value, mean, and variance50 xpCalculating the expected value and variance50 xpCalculating the sample mean100 xpChecking the result100 xpCalculating the mean and variance of a sample100 xp - 2
### Calculate some probabilities

In this chapter you'll learn to calculate various kinds of probabilities, such as the probability of the intersection of two events and the sum of probabilities of two events, and to simulate those situations. You'll also learn about conditional probability and how to apply Bayes' rule.

Calculating probabilities of two events50 xpAny overlap?50 xpMeasuring a sample100 xpJoint probabilities100 xpDeck of cards100 xpConditional probabilities50 xpDelayed flights100 xpContingency table100 xpMore cards100 xpTotal probability law50 xpFormula 1 engines100 xpVoters100 xpBayes' rule50 xpConditioning50 xpFactories and parts100 xpSwine flu blood test100 xp - 3
### Important probability distributions

Until now we've been working with binomial distributions, but there are many probability distributions a random variable can take. In this chapter we'll introduce three more that are related to the binomial distribution: the normal, Poisson, and geometric distributions.

Normal distributions50 xpRange of values50 xpPlotting normal distributions100 xpWithin three standard deviations50 xpNormal probabilities50 xpRestaurant spending example100 xpSmartphone battery example100 xpAdults' heights example100 xpPoisson distributions50 xpATM example100 xpHighway accidents example100 xpGenerating and plotting Poisson distributions100 xpGeometric distributions50 xpCatching salmon example100 xpFree throws example100 xpGenerating and plotting geometric distributions100 xp - 4
### Probability meets statistics

No that you know how to calculate probabilities and important properties of probability distributions, we'll introduce two important results: the law of large numbers and the central limit theorem. This will expand your understanding on how the sample mean converges to the population mean as more data is available and how the sum of random variables behaves under certain conditions. We will also explore connections between linear and logistic regressions as applications of probability and statistics in data science.

From sample mean to population mean50 xpGenerating a sample100 xpCalculating the sample mean100 xpPlotting the sample mean100 xpAdding random variables50 xpSample means100 xpSample means follow a normal distribution100 xpAdding dice rolls100 xpLinear regression50 xpFitting a model100 xpPredicting test scores100 xpStudying residuals100 xpLogistic regression50 xpFitting a logistic model100 xpPredicting if students will pass100 xpPassing two tests100 xpWrapping up50 xp

For Business

### Training 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and moreCollaborators

Prerequisites

Introduction to Statistics in PythonAlexander A. Ramírez M.

See MoreCEO at Synergy Vision

## What do other learners have to say?

## Join over 14 million learners and start Foundations of Probability in Python today!

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.