Alright, let's move on and do another more complicated example using some real Python code. We can then see how we might actually implement these ideas using Python.
Let's put conditional probability into action here and use some of the ideas to figure out if there's a relationship between age and buying stuff using some fabricated data. Go ahead and open up the ConditionalProbabilityExercise.ipynb here and follow along with me if you like.
What I'm going to do is write a little bit of Python code that creates some fake data:
from numpy import random random.seed(0) totals = {20:0, 30:0, 40:0, 50:0, 60:0, 70:0} purchases = {20:0, 30:0, 40:0, 50:0, 60:0, 70:0} totalPurchases = 0 for _ in range(100000): ...