liveBook · Manning

Chapter 16: Markov processes and the Metropolis algorithm

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

This chapter introduces Markov processes and uses them as the foundation for Metropolis sampling of continuous posterior distributions.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduces Markov processes and uses them as the foundation for Metropolis sampling of continuous posterior distributions.

Key terms: Markov process, Markov texts, Metropolis algorithm, continuous posterior distributions, prior distribution, observations, posterior distribution, continuous distribution, language models

16.1 What is a Markov process?

This section defines Markov processes, represents one as a distribution of state sequences, and illustrates the idea with gambler’s ruin and practical applications.

Key terms: Markov process, state, initial state, transition function, sample, Markov distribution, T, initial distribution, likelihood function, empty distribution

16.2 Markov texts

This section builds a word-level Markov process from Shakespeare sentences, explains why its generated text is limited, and contrasts its random generation with human intention.

Key terms: Markov process, state, initial distribution, transition function, categorical distribution, sentences, words, sentence terminators, empty distribution, mutable builder

16.3 Computing posteriors of continuous distributions

This section derives an unnormalized posterior PDF for continuous Bayesian updating and explains why the Metropolis algorithm is needed to sample from it.

Key terms: prior, likelihood function, posterior, continuous distribution, PDF, Weight, P(evidence), non-normalized PDF, relative weight, support

16.4 The Metropolis algorithm

This section explains how the Metropolis algorithm uses a Markov process and accept-or-reject proposals to sample a target distribution from only its non-normalized PDF.

Key terms: Metropolis algorithm, current sample, proposed sample, proposal distribution, weight, standard uniform sample, non-normalized PDF, weight function, quotient, target distribution

16.5 Sampling posteriors with Metropolis

This section applies the Metropolis algorithm to turn a continuous prior and likelihood into posterior samples, illustrated with inferring a coin’s fairness from observed flips.

Key terms: Metropolis algorithm, initial distribution, proposal distribution, support, target distribution, prior, binomial distribution, likelihood, trials, successes

16.6 Summary

This summary recaps how Markov processes generate state sequences, how they can produce text, and how the Metropolis algorithm samples continuous posterior distributions.

Concepts explained in this chapter

← Chapter 15: Sampling continuous distributions

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.