We present an exact Bayesian inference method for discrete statistical models, which can find exact solutions to a large class of discrete inference problems, even with infinite support and continuous priors. To express such models, we introduce a probabilistic programming language that supports discrete and continuous sampling, discrete observations, affine functions, (stochastic) branching, and conditioning on discrete events. Our key tool is probability generating functions: they provide a compact closed-form representation of distributions that are definable by programs, thus enabling the exact computation of posterior probabilities, expectation, variance, and higher moments. Our inference method is provably correct and fully automated in a tool called Genfer, which uses automatic differentiation (specifically, Taylor polynomials), but does not require computer algebra. Our experiments show that Genfer is often faster than the existing exact inference tools PSI, Dice, and Prodigy. On a range of real-world inference problems that none of these exact tools can solve, Genfer's performance is competitive with approximate Monte Carlo methods, while avoiding approximation errors.
翻译:我们提出一种针对离散统计模型的精确贝叶斯推理方法,该方法能够求解一大类离散推理问题的精确解,即便模型具有无限支撑域和连续先验分布。为表达此类模型,我们引入了一种概率编程语言,支持离散与连续采样、离散观测、仿射函数、(随机)分支以及基于离散事件的条件约束。我们的核心工具是概率生成函数:它能以紧凑的闭式形式表示程序可定义的分布,从而实现对后验概率、期望、方差及高阶矩的精确计算。所提出的推理方法在理论上可证明其正确性,并已在名为Genfer的工具中完全自动化实现。该工具采用自动微分技术(具体而言为泰勒多项式),且无需计算机代数系统辅助。实验表明,在处理多种现有精确推理工具(PSI、Dice、Prodigy)无法解决的现实世界推理问题时,Genfer的性能可与近似蒙特卡洛方法媲美,同时避免了近似误差。