python - Pymc3 类型错误 __init__() 得到了一个意外的关键字参数 'coords'
问题描述
我正在使用 pymc3 设置混合效果模型,使用属性坐标将各个截距值分配给每个测试对象列表(黑猩猩)以及处理列表(治疗)。我从我正在上的一门大学课程中获得了代码,所以我知道它适用于我的教授(他使用 Mac,而我是个人电脑)。尽管在 conda 中更新了 pymc3,但对我不起作用。找不到任何类似的错误帖子。帮助!
代码:
with pm.Model(coords={'Chimp':Chimp, 'Treat': Treatment}) as Chimps:
# Individual intercepts
β0 = pm.Normal('Actor', 0, 1.7, dims='Chimp')
# Treatment effects
β1 = pm.Normal('Treatment', 0, 0.25, dims='Treat')
# Linear model
p = pm.invlogit(β0[Ia]+β1[It])
# Likelihood
Yi = pm.Binomial('Yi', 1, p,observed=L)
治疗看起来像这样:['R/N', 'L/N', 'R/P', 'L/P']
黑猩猩看起来像这样:['Chimp 1', 'Chimp 2', 'Chimp 3' , '黑猩猩 4', '黑猩猩 5', '黑猩猩 6', '黑猩猩 7']
完整的错误消息如下所示:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-a4c6b628083c> in <module>
----> 1 with pm.Model(coords={'Chimp':Chimp, 'Treat': Treatment}) as Chimps:
2 # Use coords to connect the individual treatment/chimp names to the different intercepts
3
4 # Individual intercepts
5 # mixed effect model? every chimp gets their own intercept
C:\ProgramData\Anaconda3\lib\site-packages\pymc3\model.py in __call__(cls, *args, **kwargs)
274 instance = cls.__new__(cls, *args, **kwargs)
275 with instance: # appends context
--> 276 instance.__init__(*args, **kwargs)
277 return instance
278
TypeError: __init__() got an unexpected keyword argument 'coords'
解决方案
推荐阅读
- piranha-cms - Piranha CMS - 自定义块不会保存
- javascript - Cypress 遍历数组中的元素
- typescript - 如何使用模型“提交”按钮提交表单
- reactjs - StencilJS 从 React 传入对象数组
- php - Woocommerce 单一支付链接
- python - 作为 Pandas 数据框名称的名称列表
- appimage - appimage-builder:AppImage创建成功但没有在其他机器上运行
- flutter - Flutter:了解 pod 与依赖项
- c# - 如何在 C# 应用程序中为读/写应用程序获得一致的路径?
- ruby-on-rails - 带有多个 AWS 密钥的 Rails 应用程序