liveBook · Manning

Chapter 14: Third abstract nonsense interlude: The probability monad

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

This chapter introduction frames discrete probability distributions as another monad that lifts ordinary value workflows into workflows over random values.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduction frames discrete probability distributions as another monad that lifts ordinary value workflows into workflows over random values.

Key terms: probability distribution type, monad, generic types, workflow, normal values, random values, abstract nonsense interlude, category theory, endofunctors, monad design pattern

14.1 The requirements for a monad

This section shows how discrete probability distributions satisfy the monad pattern by defining unit, bind, map, and join in probabilistic terms.

Key terms: IDiscreteDistribution<T>, probability mass function, PMF, Singleton<T>.Distribution(T), unit operation, Bind, prior, likelihood function, joint distribution, marginalizing projection

14.2 Probability distributions as additive monads

This section shows that discrete probability distributions satisfy the extra addition, zero, and Bind requirements of an additive monad.

Key terms: additive monad, MZero, Bind, discrete probability distribution, support, weights, empty distribution, categorical distribution, ToJoint, least common multiple

14.3 A critique

This section assesses the strengths and limits of the discrete probability-distribution system and previews continuous and sequence-based sampling as the next challenges.

Key terms: probability distributions, likelihood functions, joint distributions, Bayesian inference, posterior likelihoods, alias algorithm, support, integer weights, fractional weights, O(n)

14.4 Summary

This summary recaps discrete distributions as an additive monad for principled Bayesian manipulation of finite categorical probabilities, while noting the limits of that scope.

Where this is used later

Concepts explained in this chapter

← Chapter 13: Conditional probability with Bayes’ theorem 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.