Sample Spaces and Events
A sample space is the set of all possible outcomes.
If we roll a six-sided die, the sample space is:
An event is a subset of the sample space.
For example, the event "roll an even number" is:
The sample space depends on what question we are asking. For a die roll, the
outcomes may be numbers {1, 2, 3, 4, 5, 6}. For a classifier, the outcomes may
be labels such as {cat, dog, car}.
An event is not necessarily one outcome. It can contain many outcomes. "Even
number" contains 2, 4, and 6.
Probability of an Event
If all outcomes are equally likely:
For the even-number event:
If outcomes are not equally likely, we do not count outcomes. We add their probabilities.
For a classifier distribution:
cat: 0.7
dog: 0.2
car: 0.1
the event "animal" is {cat, dog}. Its probability is:
That is a common source of mistakes. Counting outcomes works only when the outcomes have equal probability. A model distribution often assigns unequal probabilities, so event probability comes from adding probability mass.
ML Reading
A dataset is not the whole world. It is a sample from a larger space of possible examples.
Probability helps us reason about what we have seen and what we may see later.
This is why probability sits before statistics and machine learning evaluation. It gives us a precise way to talk about possible examples, possible labels, and events that combine many outcomes.
A fair die has outcomes {1, 2, 3, 4, 5, 6}.
What is the probability of rolling a number greater than 4?
Compute it first, then check your number.
Hint
The favorable outcomes are 5 and 6.
Solution
There are 2 favorable outcomes out of 6, so the probability is 2/6 = 1/3,
about 0.333. Counting works here because the die outcomes are equally likely.
For a die roll, the event "odd number" is {1, 3, 5}.
How many outcomes are in this event?
Compute it first, then check your number.
Hint
Count the listed outcomes in the event.
Solution
The event contains 1, 3, and 5, so it has 3 outcomes. An event can
contain several outcomes, not just one.
A classifier assigns:
cat: 0.7
dog: 0.2
car: 0.1
What is the probability of the event "animal" = {cat, dog}?
Compute it first, then check your number.
Hint
Add the probabilities of cat and dog.
Solution
P(animal) = P(cat) + P(dog) = 0.7 + 0.2 = 0.9. The classifier assigns unequal
probabilities, so the event probability comes from adding mass.
In {cat, dog, car}, is {cat, dog} the whole sample space or an event?
Answer it first, then check.
Hint
It is a subset of all possible labels.
Solution
{cat, dog} is an event because it is a subset of the full sample space
{cat, dog, car}.
A classifier assigns:
cat: 0.7
dog: 0.2
car: 0.1
Enter 1 if the probability of {cat, dog} is found by adding 0.7 + 0.2,
not by counting two labels out of three.
Compute it first, then check your number.
Hint
The labels do not have equal probability.
Solution
Enter 1. Since the labels have unequal probabilities, the event probability
is 0.7 + 0.2 = 0.9. Counting labels would ignore the model's distribution.
Before Moving On
An event is a set of outcomes. Probability measures the event.