我正在 Python 中使用 BNLearn 进行推理,并且想创建一个类似于所附图像的绘图。 可以吗?
你能解释一下为什么你觉得 pyAgrum 很难吗?
代码:
import pyAgrum as gum
import pyAgrum.lib.notebook as gnb
bn=gum.fastBN("C{a|b|c}->D{a|b|c}<-A{a|b|c}->B{a|b|c}->E{a|b|c}<-F{a|b}")
bn.cpt("A").fillWith(1).normalize()
bn.cpt("C").fillWith([0.743,0.205,0.052])
bn.cpt("F").fillWith([0.502,0.498])
gnb.sideBySide(gnb.getBN(bn),gnb.getInference(bn),gnb.getInference(bn,evs={"B":"b"},targets={"B","C","F","E"}))