liveBook · Manning

Chapter 15: Sampling continuous distributions

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

This chapter introduction positions the next two chapters as extending sampling and Bayesian reasoning from categorical distributions to one-dimensional continuous distributions, with this chapter focusing on sampling techniques.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduction positions the next two chapters as extending sampling and Bayesian reasoning from categorical distributions to one-dimensional continuous distributions, with this chapter focusing on sampling techniques.

Key terms: categorical distributions, one-dimensional continuous distributions, real numbers, Bayesian reasoning, uniform distribution, normal distribution, inverse transform algorithm, rejection-sampling algorithm, continuous distributions, sampling

15.1 What is a continuous probability distribution?

This section defines continuous probability distributions and PDFs, explains how probabilities come from relative areas under a PDF, and previews methods for sampling them.

Key terms: continuous probability distribution, support, sample, probability density function, PDF, area under the curve, total area, beta distribution, normalized, non-normalized PDF

15.2 Sampling the continuous uniform distribution

This section defines and samples the continuous uniform distribution, introduces continuous-distribution weighting through PDFs, and visualizes samples with vertical histograms.

Key terms: continuous uniform distribution, standard distribution, minimum, maximum, support, double-weighted distribution, continuous distribution, PDF, probability density function, non-normalized PDF

15.3 Sampling the normal distribution

This section characterizes normal distributions and shows how Box-Muller sampling of a standard normal can be rescaled to sample any normal distribution.

Key terms: normal distribution, Gaussian distribution, mean, standard deviation, PDF, tails, standard normal distribution, Box-Muller transform, standard uniform distribution, polar coordinates

15.4 The inverse transform method

This section explains how inverse transform sampling turns a standard uniform sample into a sample from any continuous distribution whose quantile function is known.

Key terms: inverse transform method, standard continuous uniform distribution, quantile function, normalized PDF, cumulative distribution function, CDF, inverse, Cauchy distribution, fat tails, normal distribution

15.5 Rejection sampling

This section adapts rejection sampling to continuous target distributions by using a scaled helper distribution to propose and accept or reject samples.

Key terms: rejection sampling, target distribution, non-normalized PDF, helper distribution, support, scale factor, dart, x coordinate, y coordinate, scaled helper function

15.5.1 Clamping with rejection sampling

This subsection shows how rejection sampling clamps a distribution by discarding samples outside a chosen range, eliminating undesirable tails.

Key terms: clamping, support, rejection sampling, unclamped distribution, clamped range, normal distribution, long, thin tails, impossible regions, low-probability regions, helper distribution

15.5.2 Problems with rejection sampling

This subsection identifies rejection sampling's unbounded runtime and manual helper-fitting limitations, motivating automatic sampling methods for continuous posteriors.

Key terms: rejection sampling, rejections, acceptance area, rejection area, helper distribution, scale factor, non-normalized PDF, standard normal, Cauchy distribution, fatter tails

15.6 Summary

This summary recaps how PDFs, CDFs, quantile functions, and rejection sampling support sampling from continuous probability distributions.

Where this is used later

Concepts explained in this chapter

← Chapter 14: Third abstract nonsense interlude: The probability monad Chapter 16: Markov processes and the Metropolis algorithm →

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.