liveBook · Manning

Chapter 13: Conditional probability with Bayes’ theorem

What you will learn in chapter 13 of Fabulous Adventures in Data Structures and Algorithms

This chapter introduces using Bayes’ theorem with discrete probability distributions to update prior beliefs from observations and reason from effects back to likely causes.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduces using Bayes’ theorem with discrete probability distributions to update prior beliefs from observations and reason from effects back to likely causes.

Key terms: Bayes’ theorem, prior distribution, posterior distribution, observation, conditional distribution, statistical models, causes, effects, correlated, likelihood functions

13.1 Bayes’ theorem

This section derives Bayes’ theorem from survey-table probabilities and shows how evidence updates a prior belief into a posterior diagnosis.

Key terms: marginal table, prior probability, conditional probability, joint probability, P(C), P(S|C), Bayes’ theorem, P(S)P(C|S) = P(C)P(S|C), posterior probability, evidence

13.2 Likelihood functions and joint distributions

This section represents conditional probabilities as likelihood functions and combines them with priors to construct joint distributions, including with integer weights.

Key terms: likelihood function, conditional probability, prior, Cold, Sneezed, joint distribution, categorical distribution, support, P(C & S), integer weights

13.3 Updating priors by reasoning from effects to causes

This section shows how to update a prior belief into a posterior distribution by observing an effect, constructing a joint distribution, and filtering it to reason back to possible causes.

Key terms: prior probability, posterior probability, conditional probability, diagnosis, P(C), P(C|S), IDiscreteDistribution<A>, Func<A, IDiscreteDistribution<B>>, ToJoint, Filter

13.4 Some applications of Bayesian reasoning

This section demonstrates Bayesian reasoning through medical testing, coin flips, and programmer-relevant inference applications, emphasizing how priors and likelihoods determine posteriors.

Key terms: prior, posterior, likelihood function, test sensitivity, test specificity, false positive, joint distribution, true positive, false negative, posterior distribution

13.5 Unconditional likelihood functions are independent

This section shows that independent random quantities can be combined through an unconditional likelihood function, then projected into useful derived distributions such as a D20 roll with advantage.

Key terms: unconditional likelihood function, independent random events, joint distribution, prior, likelihood function, roll with advantage, d20, discrete uniform distribution, joint probability, projection

13.6 Summary

This summary recaps how priors and likelihood functions produce posterior estimates through Bayesian reasoning, and why priors prevent misleading interpretations of evidence.

Where this is used later

Concepts explained in this chapter

← Chapter 12: A better abstraction for randomness Chapter 14: Third abstract nonsense interlude: The probability monad →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.