30 research outputs found
Denotational validation of higher-order Bayesian inference
We present a modular semantic account of Bayesian inference algorithms for
probabilistic programming languages, as used in data science and machine
learning. Sophisticated inference algorithms are often explained in terms of
composition of smaller parts. However, neither their theoretical justification
nor their implementation reflects this modularity. We show how to conceptualise
and analyse such inference algorithms as manipulating intermediate
representations of probabilistic programs using higher-order functions and
inductive types, and their denotational semantics. Semantic accounts of
continuous distributions use measurable spaces. However, our use of
higher-order functions presents a substantial technical difficulty: it is
impossible to define a measurable space structure over the collection of
measurable functions between arbitrary measurable spaces that is compatible
with standard operations on those functions, such as function application. We
overcome this difficulty using quasi-Borel spaces, a recently proposed
mathematical structure that supports both function spaces and continuous
distributions. We define a class of semantic structures for representing
probabilistic programs, and semantic validity criteria for transformations of
these representations in terms of distribution preservation. We develop a
collection of building blocks for composing representations. We use these
building blocks to validate common inference algorithms such as Sequential
Monte Carlo and Markov Chain Monte Carlo. To emphasize the connection between
the semantic manipulation and its traditional measure theoretic origins, we use
Kock's synthetic measure theory. We demonstrate its usefulness by proving a
quasi-Borel counterpart to the Metropolis-Hastings-Green theorem
Amortized Rejection Sampling in Universal Probabilistic Programming
Existing approaches to amortized inference in probabilistic programs with
unbounded loops can produce estimators with infinite variance. An instance of
this is importance sampling inference in programs that explicitly include
rejection sampling as part of the user-programmed generative procedure. In this
paper we develop a new and efficient amortized importance sampling estimator.
We prove finite variance of our estimator and empirically demonstrate our
method's correctness and efficiency compared to existing alternatives on
generative programs containing rejection sampling loops and discuss how to
implement our method in a generic probabilistic programming framework
De Finetti's construction as a categorical limit
This paper reformulates a classical result in probability theory from the
1930s in modern categorical terms: de Finetti's representation theorem is
redescribed as limit statement for a chain of finite spaces in the Kleisli
category of the Giry monad. This new limit is used to identify among
exchangeable coalgebras the final one.Comment: In proceedings of CMCS 202
Functional Programming for Modular Bayesian Inference
We present an architectural design of a library for Bayesian modelling and inference in modern functional programming languages. The novel aspect of our approach are modular implementations of existing state-of- the-art inference algorithms. Our design relies on three inherently functional features: higher-order functions, inductive data-types, and support for either type-classes or an expressive module system. We provide a perfor- mant Haskell implementation of this architecture, demonstrating that high-level and modular probabilistic programming can be added as a library in sufficiently expressive languages.
We review the core abstractions in this architecture: inference representations, inference transformations, and inference representation transformers. We then implement concrete instances of these abstractions, counterparts to particle filters and Metropolis-Hastings samplers, which form the basic building blocks of our library. By composing these building blocks we obtain state-of-the-art inference algorithms: Resample-Move Sequential Monte Carlo, Particle Marginal Metropolis-Hastings, and Sequential Monte Carlo Squared. We evaluate our implementation against existing probabilistic programming systems and find it is already com- petitively performant, although we conjecture that existing functional programming optimisation techniques could reduce the overhead associated with the abstractions we use. We show that our modular design enables deterministic testing of inherently stochastic Monte Carlo algorithms. Finally, we demonstrate using OCaml that an expressive module system can also implement our design