A Final Word

In this lesson, we will first summarize all the concepts we learned, then describe a whole lot of interesting stuff that we did not get to and lastly, mention a few reference papers and further reading that inspired this course.

All right, let’s finish this course off!


Goal of the Course

If you come away with nothing else from this course, the key message is: probabilistic programming is essential, it is too hard today, and we can do a lot better than we are doing. We need to build better tools that leverage the type system and support line-of-business programmers who need to do probabilistic work, the same way that we built better tools for programmers who needed to use sequences, or databases, or asynchrony.


Course Summary

  • We started this course with us complaining about System.Random, hence the name of the course. Even though some of the implementation details have finally improved after only some decades of misleading developers, we are still dealing with random numbers like it was 1972.

  • The abstraction that we’re missing is to make “value drawn from a random distribution” a part of the type system, the same way that “function that returns a value”, or “sequence of values”, or “value that might be null” is part of the type system.

  • The type we want is something like a sequence enumeration, but instead of a “move next” operation, we’ve got a “sample” operation.

  • If we stick to simple distributions where the support is finite and small and the “weights” are integers, and restrict ourselves to pure functions, we can create new distributions from old ones using the same operations that we use to create new sequences from old ones: the LINQ operators Select, SelectMany and Where.

  • Moreover, we can compute distributions exactly at runtime, without doing rejection sampling or other clever techniques.

  • And we can even use query comprehension syntax, which is a pleasant and interesting way to write a probabilistic workflow.

  • From this we can see that probability distributions are monads; P(A)P(A) ...