Inference algorithms for probabilistic programming are complex imperative programs with many moving parts. Efficient inference often requires customising an algorithm to a particular probabilistic model or problem, sometimes called inference programming. Most inference frameworks are implemented in languages that lack a disciplined approach to side effects, which can result in monolithic implementations where the structure of the algorithms is obscured and inference programming is hard. Functional programming with typed effects offers a more structured and modular foundation for programmable inference, with monad transformers being the primary structuring mechanism explored to date. This paper presents an alternative approach to programmable inference, based on algebraic effects, building on recent work that used algebraic effects to represent probabilistic models. Using effect signatures to specify the key operations of the algorithms, and effect handlers to modularly interpret those operations for specific variants, we develop three abstract algorithms, or inference patterns, representing three important classes of inference: Metropolis-Hastings, particle filtering, and guided optimisation. We show how our approach reveals the algorithms' high-level structure, and makes it easy to tailor and recombine their parts into new variants. We implement the three inference patterns as a Haskell library, and discuss the pros and cons of algebraic effects vis-a-vis monad transformers as a structuring mechanism for modular imperative algorithm design. It should be possible to reimplement our library in any typed functional language able to emulate effects and effect handlers.


翻译:概率编程的推断算法是复杂的命令式程序,具有许多移动部件。有效的推断通常需要定制算法以适应特定的概率模型或问题,有时称为推断编程。大多数推断框架在缺乏对副作用的纪律处理方法的语言中实现,这可能导致单片实现,在这些实现中,算法的结构被掩盖,推断编程变得困难。具有类型效果的函数编程提供了一种更具结构化和模块化的可编程推论基础,其中单子转换器是迄今为止探索的主要结构机制。本文提出了一种基于代数效应的可编程推理方法,基于最近使用代数效应表示概率模型的工作。使用效果签名来指定算法的关键操作,效果处理器来模块化地解释这些操作以适用于特定的变量,我们开发了三种抽象算法或推理模式,代表三种重要的推理类别:Metropolis-Hastings,粒子滤波和引导优化。我们展示了我们的方法如何揭示算法的高层结构,并使其易于调整和重新组合其部分以生成新的变体。我们使用Haskell库实现了三种推理模式,并讨论了代数效应相对于单子转换器作为模块化命令式算法设计的结构机制的优缺点。在任何能够模拟效果和效果处理器的类型化功能语言中重新实现我们的库应该是可能的。

0
下载
关闭预览

相关内容

【干货书】开放数据结构,Open Data Structures,337页pdf
专知会员服务
16+阅读 · 2021年9月17日
专知会员服务
41+阅读 · 2020年12月18日
自动结构变分推理,Automatic structured variational inference
专知会员服务
38+阅读 · 2020年2月10日
代码重构:面向单元测试
阿里技术
0+阅读 · 2022年7月29日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
Transferring Knowledge across Learning Processes
CreateAMind
25+阅读 · 2019年5月18日
深度自进化聚类:Deep Self-Evolution Clustering
我爱读PAMI
14+阅读 · 2019年4月13日
【泡泡一分钟】DS-SLAM: 动态环境下的语义视觉SLAM
泡泡机器人SLAM
23+阅读 · 2019年1月18日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
3+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
Arxiv
0+阅读 · 2023年6月4日
Arxiv
0+阅读 · 2023年6月2日
Arxiv
0+阅读 · 2023年6月1日
An Attentive Survey of Attention Models
Arxiv
43+阅读 · 2020年12月15日
VIP会员
相关资讯
代码重构:面向单元测试
阿里技术
0+阅读 · 2022年7月29日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
Transferring Knowledge across Learning Processes
CreateAMind
25+阅读 · 2019年5月18日
深度自进化聚类:Deep Self-Evolution Clustering
我爱读PAMI
14+阅读 · 2019年4月13日
【泡泡一分钟】DS-SLAM: 动态环境下的语义视觉SLAM
泡泡机器人SLAM
23+阅读 · 2019年1月18日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
3+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员