BART是贝叶斯非参数模型,可以使用Backfitting MCMC进行拟合 。
我不使用任何软件包…… MCMC是从头开始实现的。




考虑协变量数据和成果为主题,。在这个 示例中,数据看起来像这样:


我们可能会考虑以下概率模型


基本上我们使用三次多项式对条件均值进行建模。请注意,这是更一般的 模型的特例








在这种情况下和。该模型在参数矢量的每个元素上具有平坦的先验和在方差参数上具有形状和速率的反伽马先验。






每个条件后验都是高斯(因为共轭)。我们可以使用共轭Gibbs或Metropolis从中进行采样。我们也可以将整个参数矢量作为一个块进行采样,但是在这篇文章中我们将坚持反向拟合 – 这本身就是一个Gibbs采样器。我们仍然从其他条件的每个条件的条件后验中进行抽样。然而,我们利用关键的洞察力,每个条件后验取决于其他beta ,仅由残差表示




直观地,是在减去其他项(非)所解释的部分之后的左手平均值的部分。它也是正常分布的,


在正常之前,后验可以通过共轭来计算


Backfitting MCMC如下进行。首先,初始化所有测试版除外。这完全是任意的 – 您可以从任何参数开始。然后,在每个Gibbs迭代中,
- 计算与值在当前迭代。来自后验的样本 以电流抽取为条件。
- 计算与值在当前迭代。注意,使用步骤1中的值。来自后部的样本 。
- 对所有beta参数继续此过程。
- 绘制完所有参数后,进行采样。这个后验是另一个反伽马。

术语反向拟合似乎是合适的,因为在每次迭代中,我们都“退出” 我们想要使用其他测试版进行采样的分布。

为了获得拟合的回归线,我们需要从后验预测分布中进行采样。我们在每个Gibbs迭代中的步骤4之后通过绘制值来执行此操作



上标表示使用来自Gibbs迭代的值的参数。


可下载资源
关于作者
Kaizong Ye是拓端研究室(TRL)的研究员。在此对他对本文所作的贡献表示诚挚感谢,他在上海财经大学完成了统计学专业的硕士学位,专注人工智能领域。擅长Python.Matlab仿真、视觉处理、神经网络、数据分析。
本文借鉴了作者最近为《R语言数据分析挖掘必知必会 》课堂做的准备。
非常感谢您阅读本文,如需帮助请联系我们!