基于张量流概率的贝叶斯Logistic回归

2024-05-14 03:32:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我在尝试运行关于张量流概率的贝叶斯逻辑回归示例时遇到了一些问题,如An introduction to probabilistic programming, now available in TensorFlow Probability所示。在

如果我只是在站点上运行代码,就会出现以下错误:

Traceback (most recent call last):
  File "<input>", line 75, in <module>
TypeError: make_simple_step_size_update_policy() missing 1 required positional argument: 'num_adaptation_steps'

当我指定num_adaptation_steps=5时,我得到以下错误:

^{pr2}$

我不知道我做错了什么,任何帮助都将不胜感激。谢谢!!在


Tags: toinan示例错误逻辑steps概率
1条回答
网友
1楼 · 发布于 2024-05-14 03:32:46

第2章现行Colab中的挑战者代码应该适用:

https://colab.sandbox.google.com/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_TFP.ipynb#scrollTo=oHU-MbPxs8iL

hmc=tfp.mcmc.TransformedTransitionKernel(
inner_kernel=tfp.mcmc.HamiltonianMonteCarlo(
    target_log_prob_fn=unnormalized_posterior_log_prob,
    num_leapfrog_steps=40,
    step_size=step_size,
    step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(
        num_adaptation_steps=int(burnin * 0.8)),
    state_gradients_are_stopped=True),
bijector=unconstraining_bijectors)

我刚刚注意到,这一章中前面的HMC示例缺少num_adaptation_步骤,所以我将很快做一个PR来解决这个问题。或者你也可以这么做。在

谢谢 迈克

相关问题 更多 >