问题描述
我在石榴中使用 from_samples()
构建了贝叶斯网络.我可以使用 model.predict()
从模型中获得最大可能的预测.我想知道是否有一种方法可以有条件地(或无条件地)从该贝叶斯网络中采样?即是否从网络中获得随机样本,而不是最大可能的预测?
I constructed a Bayesian network using from_samples()
in pomegranate. I'm able to get maximally likely predictions from the model using model.predict()
. I wanted to know if there is a way to sample from this Bayesian network conditionally(or unconditionally)? i.e. is there a get random samples from the network and not the maximally likely predictions?
我查看了 model.sample()
,但是它引发了 NotImplementedError
.
I looked at model.sample()
, but it was raising NotImplementedError
.
如果使用 pomegranate
无法做到这一点,那么还有哪些其他库对于Python中的贝叶斯网络很有用?
Also if this is not possible to do using pomegranate
, what other libraries are great for Bayesian networks in Python?
推荐答案
model.sample()
到现在为止,如果我正确地看到了提交历史,就应该已经实现.
您可以查看 PyMC ,它也支持分发混合.但是,我不知道其他任何具有类似工厂方法的工具箱,例如pomogranate中的 from_samples()
.
You can have a look at PyMC which supports distribution mixtures as well.However, I dont know any other toolbox with a similar factory method like from_samples()
in pomogranate.
这篇关于来自石榴的贝叶斯网络的样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!