Data Science · Chapter 17 of 43
Probability Basics
Probability measures uncertainty on a 0–1 scale. Rules: P(A or B) = P(A)+P(B)−P(A and B); independent events multiply.
Understanding probability is the foundation of statistics, ML and A/B testing.
Example 1 (python)
# P(rolling a 6) with a fair die
print(1/6)Output
0.16666666666666666One in six outcomes.
Example 2 (python)
# P(two 6s in a row) = 1/6 * 1/6
print((1/6) ** 2)Output
0.027777777777777776Independent events multiply.
Key points
- Probability lives in [0, 1].
- Complement: P(not A) = 1 − P(A).
- Independent events multiply.
- Conditional probability underlies Bayes.
💡 Note: Real-world events are rarely truly independent — beware of the multiplication assumption.
