用于绘制结构并插入贝叶斯网络的条件概率的库?
我正在尝试绘制贝叶斯网络的结构,但是我无法手工卷入条件概率。 我尝试了Bnlearn,Pomgranate ...有人知道可以允许我的图书馆吗?
import pandas as pd
from pomegranate import *
import bnlearn
edges = [
('A', 'B'),
("B", "C"),
("C", "D")]
DAG = bn.make_DAG(edges, verbose =0)
df = pd.DataFrame({'A':[0,0,0,1,0], 'B':[0,0,1,0,0], 'C':[1,1,0,0,1], 'D':[0,1,0,1,1]})
df.head()
model = BayesianNetwork.from_samples(df.to_numpy(), state_names=df.columns.values, algorithm='exact')
print(model)
有人知道如何在变量之间添加条件概率?
I am trying to draw the structure of a bayesian network and but I can't wirte by hand the conditional probability.
I have trying bnlearn, pomgranate... someone know a library that will allow me?
import pandas as pd
from pomegranate import *
import bnlearn
edges = [
('A', 'B'),
("B", "C"),
("C", "D")]
DAG = bn.make_DAG(edges, verbose =0)
df = pd.DataFrame({'A':[0,0,0,1,0], 'B':[0,0,1,0,0], 'C':[1,1,0,0,1], 'D':[0,1,0,1,1]})
df.head()
model = BayesianNetwork.from_samples(df.to_numpy(), state_names=df.columns.values, algorithm='exact')
print(model)
Someone know how I can add the conditional probability between the variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为其中许多人有办法做到这一点。您可以尝试例如pyagrum( https://agrum.org )。
有关更多信息,请参见笔记本: https:///pyagrum.readagrum.readthedocs.io/en en en en /1.1.1/notebooks.html
I think that many of them have a way to do that. You can try for instance pyAgrum (https://agrum.org).
For more, see the notebooks : https://pyagrum.readthedocs.io/en/1.1.1/notebooks.html