-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
fg = graphs.FactorGraph()
x1 = nodes.VNode("x1", rv.Discrete)
x2 = nodes.VNode("x2", rv.Discrete)
x3 = nodes.VNode("x3", rv.Discrete)
x4 = nodes.VNode("x4", rv.Discrete)
x5 = nodes.VNode("x5", rv.Discrete)
dist_fa = [
[
[0.1, 0.2],
[0.1, 0.1]
],
[
[0.2, 0.05],
[0.2, 0.05]
]
]
fa = nodes.FNode("fa", rv.Discrete(dist_fa, x1, x2,x3))
dist_fb = [[0.1, 0.4],
[0.2, 0.3]]
fb = nodes.FNode("fb", rv.Discrete(dist_fb, x3, x4))
dist_fc = [[0.5, 0.1],
[0.2, 0.2]]
fc = nodes.FNode("fc", rv.Discrete(dist_fc, x3, x5))
fg.set_nodes([x1, x2, x3, x4, x5])
fg.set_nodes([fa,fb,fc])
fg.set_edge(x1, fa)
fg.set_edge(x2, fa)
fg.set_edge(fa, x3)
fg.set_edge(x4, fb)
fg.set_edge(fb, x3)
fg.set_edge(x3, fc)
fg.set_edge(fc, x5)
fg.set_edge(x2, fb)
fg.set_edge(fb, x3)
fg.set_edge(x2, fc)
fg.set_edge(fc, x4)
belief = inference.max_sum(fg,x5)`
for this problem I get Value assignment
x5 0
x3 1
x1 3
x2 1
x4 0
but all of the variables are binary. SO x1 = 3 does not looks right
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels