1. Home
  2. Explore
  3. Mathematics
  4. Introduction to Probability

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Probability

Speaker 1Speaker 2

Introduction to Probability

14:28
0:00-14:28
  1. Hope

    Today we're introducing probability, starting with the foundations we'll need later for Bayes' nets. The reason probability matters is simple: the real world is full of uncertainty, and logic alone cannot always determine what will happen. If you leave SFO sixty minutes before a flight, for example, you cannot deduce with certainty whether you'll arrive on time.

  2. Corey

    Right. In a search problem, we usually know the current state, the goal state, the possible intermediate states, and how actions change the state. In the real world, we rarely know the complete state of the world. That state includes every fact about everything happening, and the amount we don't know is enormous.

  3. Hope

    That gives us partial observability: we observe some pieces of the world but remain uncertain about the rest. Our sensors are also noisy. Vision may give us only partial information about a sign, and a traffic report may describe conditions at one time even though we're interested in what traffic will be like later.

  4. Corey

    There are practical limits too. Even if all the data about the world were available, there would be far too much of it for us to process. And we do not always understand exactly how the world evolves—for instance, whether a tire hitting a nail will puncture depends on many details we cannot model completely.

  5. Hope

    So probability helps us model both genuine uncertainty in the world and our own limited ability to understand it. Probabilistic assertions summarize the effects of ignorance and simplification: instead of representing every detail, we say that one outcome is probably more likely than another.

  6. Corey

    Eventually, probability will connect to decision theory. An agent can choose the action that maximizes expected utility—the utility of each possible resulting state weighted by the probability of reaching that state. But first we need the basic vocabulary and rules.

  7. Hope

    We begin with a set called big omega, written as Ω, containing all possible worlds or outcomes. For one roll of a die, Ω contains the six outcomes: landing on 1, 2, 3, 4, 5, or 6.

  8. Corey

    A probability model assigns a number to each possible world. Those probabilities must be non-negative, and they must sum to 1 across all possible worlds. Because of those two rules, no individual probability can be greater than 1.

  9. Hope

    The individual outcomes are called atomic possibilities because we are treating them as indivisible for this model. An event, by contrast, is a set of outcomes—a subset of Ω. For a die, the event 'the roll is less than 4' is the set {1, 2, 3}, while the event 'the roll is odd' is {1, 3, 5}.

  10. Corey

    The probability of an event is the sum of the probabilities of all the outcomes in that event. With a fair die, each outcome has probability one-sixth, so the probability of rolling less than 4 is one-sixth plus one-sixth plus one-sixth, or one-half.

  11. Hope

    These rules are not arbitrary preferences. If your probability assignments violate them—for example, if the probability of an event is not the sum of the probabilities assigned to its component outcomes—then a sequence of bets can be constructed that guarantees you lose money. In other words, inconsistent probabilities can be exploited.

  12. Corey

    Now let's introduce random variables. A random variable represents some aspect of the world about which we may be uncertain, and it is usually written with a capital letter. For example, the number of people who attend a lecture varies from day to day.

  13. Hope

    Formally, a random variable is neither truly random nor technically a variable. It is a deterministic function that takes an outcome from Ω and returns a value. The apparent randomness comes from the fact that the input outcome is selected according to a probability distribution.

  14. Corey

    Take the Boolean random variable Odd for a die roll. It maps outcomes 1, 3, and 5 to true, and outcomes 2, 4, and 6 to false. If the die is fair, the probability that Odd is true is the sum of the probabilities of 1, 3, and 5, which is one-half.

  15. Hope

    A random variable can have different kinds of ranges. Temperature might have the range {hot, cold}. Travel time to the airport could have values anywhere from zero to infinity, and the location of a ghost could be represented by ordered pairs of integers.

  16. Corey

    The probability distribution of a random variable gives the probability of every value in its range. We write P(X = x) for the probability that random variable X takes value x, and this can be calculated by summing the probabilities of all worlds that X maps to x. Sometimes P(x) is used as shorthand for P(X = x), while P(X) can refer to the entire distribution.

  17. Hope

    When several random variables describe the same world, we may need their joint distribution. Suppose temperature can be hot or cold and weather can be sunny, rainy, foggy, or meteor. The joint distribution assigns a probability to every combination, such as sunny-and-hot or rainy-and-cold.

  18. Corey

    The distributions of the individual variables are called marginal distributions. The weather distribution and the temperature distribution are marginals of the joint distribution. You can compute the marginals from the joint by summing, but you generally cannot reconstruct the joint distribution from the marginals alone.

  19. Hope

    In many machine-learning models, we begin with random variables and their ranges, then define possible worlds as assignments of values to all those variables. With weather and temperature, a world is one complete pairing of a weather value and a temperature value.

  20. Corey

    The same idea applies to multiple die rolls. Two dice produce 6 possibilities for the first die and 6 for the second, giving 6 squared, or 36, possible worlds. If both dice are fair, each pair has probability one thirty-sixth.

  21. Hope

    That growth becomes a serious computational problem. If there are n variables and each has d possible values, the number of complete worlds can be d to the n. For a few hundred students, each represented by a yes-or-no attendance variable, there could be 2 to the several hundred possible attendance patterns.

  22. Corey

    So writing down the entire joint distribution can be impossible, and learning all of its entries from data can be even worse. If there are exponentially many entries, we would need an enormous amount of data to estimate them, and real-world data costs time and money.

  23. Hope

    Still, the joint distribution gives us a useful starting point. To find the probability of an event, select every world in which the event is true and add their probabilities. For example, the probability of hot and sunny is just the entry or entries corresponding to that event.

  24. Corey

    To find a marginal probability such as P(sunny), add all the joint probabilities in which the weather is sunny, regardless of temperature or any other variables. More generally, summing out variables that we do not care about is called marginalization.

  25. Hope

    Conditional probability lets us reason after receiving information. The definition is P(A given B) equals P(A and B) divided by P(B), assuming P(B) is not zero. Intuitively, we restrict attention to the worlds where B is true, then ask what fraction of those worlds also satisfy A.

  26. Corey

    For example, P(cold given rainy) is the probability of cold and rainy divided by the total probability of rainy. Likewise, P(sunny given cold) is the probability of sunny and cold divided by the marginal probability of cold.

  27. Hope

    A conditional distribution is a full distribution over one variable for a fixed value of another. The distribution of weather given that temperature is hot contains probabilities for sunny, rainy, foggy, and meteor under the hot condition. The entries must sum to 1, so we normalize the relevant column or fragment of the joint distribution.

  28. Corey

    Normalization means dividing each retained value by their total, or equivalently multiplying by a factor alpha equal to one divided by that total. If the hot column sums to one-half, multiplying every entry in that column by 2 turns it into a valid conditional distribution.

  29. Hope

    The definition of conditional probability also gives the product rule. Rearranging it, P(A and B) equals P(A given B) times P(B). This means we can construct a joint probability from a probability for B and a conditional probability for A given B.

  30. Corey

    For several variables, we apply that rule repeatedly. The joint probability P(x1, x2, x3) becomes P(x1) times P(x2 given x1) times P(x3 given x1 and x2). In general, P(x1 through xn) is the product of each variable conditioned on all the variables that came before it.

  31. Hope

    The ordering can be chosen in any way, so one ordering may be more convenient than another. The first factor is an unconditional probability because there are no earlier variables, while the later factors are conditional probabilities.

  32. Corey

    In real inference, some variables are queries, some are evidence, and some are hidden. The query variables are the outcomes we want probabilities for, the evidence variables are the observations we've received, and hidden variables may matter to the relationships even though we neither observe nor ask about them.

  33. Hope

    Inference by enumeration follows directly from the definitions. First, keep only worlds consistent with the evidence. Second, sum out the hidden variables, leaving probabilities associated with the query and evidence. Third, normalize, because after discarding inconsistent worlds the remaining values generally sum to less than 1.

  34. Corey

    For instance, suppose we want the distribution over season given that the weather is sunny. We keep the summer-and-sunny and winter-and-sunny worlds, sum over hot and cold because temperature is irrelevant, and then normalize the resulting summer and winter values so they add to 1.

  35. Hope

    Enumeration is conceptually straightforward but inefficient. Summing over every combination of hidden-variable values takes exponential time in the number of hidden variables. Storing the full joint distribution is also exponential, and estimating all of its entries from data may be infeasible.

  36. Corey

    That motivates more compact representations, eventually including Bayes' nets. But before getting there, we need Bayes' rule, which follows by rearranging the definition of conditional probability.

  37. Hope

    Bayes' rule says P(A given B) equals P(B given A) times P(A), divided by P(B). It is especially useful when the conditional probability in the direction we want is difficult to determine, but the reverse conditional is easier to learn or calculate.

  38. Corey

    Think of A as a hypothesis and B as observed data. We begin with a prior probability P(A), representing our belief before seeing the data. After observing B, we update that belief using how likely the data is under the hypothesis, P(B given A), together with the overall probability of the data, P(B).

  39. Hope

    For a medical example, suppose the data is that someone has a fever and the hypotheses are COVID or flu. It may be easier to learn how often fever occurs given each illness than to directly estimate the probability of each illness given fever. Bayes' rule reverses that direction so we can calculate the posterior belief we actually care about.

  40. Corey

    The prior matters enormously. Suppose meningitis has a prior probability of one in ten thousand, a stiff neck has probability one in one hundred, and the probability of a stiff neck given meningitis is eighty percent. Then the probability of meningitis given a stiff neck is 0.008, or 0.8 percent.

  41. Hope

    That result may feel surprising because a stiff neck is common among people with meningitis. But meningitis is rare overall, while stiff necks are relatively common for other reasons. The evidence raises the probability of meningitis by a factor of 80 compared with its prior, yet the final probability remains small.

  42. Corey

    This is the base-rate issue: people often focus on whether evidence would be typical under a hypothesis while ignoring how likely the hypothesis was to begin with. A hypothesis can explain the evidence well and still be unlikely if its prior probability is very low.

  43. Hope

    New evidence updates beliefs by conditioning. If we're estimating whether we'll reach the airport on time, learning that there are no accidents may increase the probability. Learning that it's five in the morning might increase it further because there may be fewer people on the road, while learning about heavy traffic could decrease it.

  44. Corey

    The direction of the update depends on the evidence. The key idea is that once we learn something, we restrict attention to outcomes consistent with that information and recompute the relevant probabilities within that restricted set.

  45. Hope

    The final foundational idea is independence. Two variables X and Y are independent when their joint probability factors as P(X and Y) equals P(X) times P(Y) for every pair of values.

  46. Corey

    Using the product rule, an equivalent statement is P(X given Y) equals P(X). Observing Y does not change our belief about X. Two separate rolls of a fair die illustrate this: learning that the first roll was 4 should not change the one-in-six probabilities for the second roll.

  47. Hope

    For example, the probability that roll 1 is 5 and roll 2 is 3 is one-sixth times one-sixth, or one thirty-sixth. Independence lets us represent the joint distribution much more compactly because we can store the individual distributions instead of listing every combination.

  48. Corey

    That compression can be exponential. For n independent coin flips, we only need to say that each flip is heads with probability one-half and tails with probability one-half, rather than listing all 2 to the n possible sequences.

  49. Hope

    The difficulty is that complete independence is rare. More common is conditional independence: two variables may not be independent overall, but they become independent once we condition on a third variable.

  50. Corey

    Consider traffic, rain, and whether someone carries an umbrella. Each pair is related: umbrellas suggest rain, rain may suggest traffic, and observing an umbrella can change our belief about rain. But if we already know whether it is raining, then learning about traffic should not provide additional information about whether the person carries an umbrella.

  51. Hope

    That is conditional independence. It allows us to factor complicated probability models into smaller pieces while preserving important dependencies. Conditional independence is the main idea that will make it possible to represent and reason about many uncertain variables tractably in Bayes' nets.

  52. Corey

    So the foundation is complete: possible worlds, probability models, events, random variables, distributions, joint and marginal probabilities, conditioning, normalization, the product rule, Bayes' rule, inference by enumeration, and independence. These tools explain both how to reason with uncertainty and why compact structures such as Bayes' nets are necessary.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent