Lesson 1 · Unit 03
Distributions
Probabilities sum to one; averages and spread
What you practise
- Probabilities sum to one, expected value, variance and standard deviation, uniform and normal, sampling with NumPy
Try a question from this lesson
Pick one
A bag holds 3 red, 5 blue and 2 green marbles. You draw one without looking. What is the probability that it is blue?
Correct answer
0.5
Why
5 blue out of 10 marbles is 5/10 = 0.5. A probability is a share of all the possibilities, so it always lies between 0 and 1. The count 5 is not a probability.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
A distribution sums to one
A distribution lists every outcome with its probability. Each probability is between 0 and 1, and together they sum to exactly 1: something has to happen.
For the bag: red 0.3, blue 0.5, green 0.2.
A classifier outputs the same kind of list: one probability per possible answer.
import numpy as np
p = np.array([0.3, 0.5, 0.2])
print(p.sum()) # 1.0Concept
Expected value
The expected value is the average you would get over many tries. Multiply each value by its probability and add everything up.
In symbols: E[X] = Σ value × probability, where Σ ("sigma") just means "add up over all outcomes".
Multiply matching entries, then add: it is a dot product of the values and their probabilities.
import numpy as np
values = np.array([0, 10])
probs = np.array([0.8, 0.2])
print(values @ probs) # 2.0Concept
Uniform and normal
Two shapes come up constantly. Uniform: every outcome equally likely, like a die.
Normal: a bell around the mean. Values near the mean are common, far ones are rare. Heights, measurement errors and exam scores often look like this.
A normal distribution is fixed by two numbers: its mean and its standard deviation.
normal, mean 50, std 10
within 1 std (40 to 60): about 68%
within 2 std (30 to 70): about 95%
within 3 std (20 to 80): about 99.7%9 more exercises in the app
- 4× type the answer
- 3× multiple choice
- 1× fill the blanks
- 1× true or false
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.