-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Hi,
I was trying inference, following the example in the doc:
bn = DiscreteBayesNet()
push!(bn, DiscreteCPD(:a, [0.3,0.7]))
push!(bn, DiscreteCPD(:b, [0.2,0.8]))
push!(bn, DiscreteCPD(:c, [:a, :b], [2,2],
[Categorical([0.1,0.9]),
Categorical([0.2,0.8]),
Categorical([1.0,0.0]),
Categorical([0.4,0.6]),
]))
ϕ = infer(bn, :c, evidence=Assignment(:b=>1))
While this compiles fine, the output produced is:
2 instantiations:
c (2)
While the doc says that the output is supposed to be:
2×2 DataFrame
Row c potential
Int64 Float64
1 1 0.17
2 2 0.83
This can be easily fixed by doing:
ϕ = DataFrame(infer(bn, :c, evidence=Assignment(:b=>1)))
instead of what is written in the docs. At first sight for someone new, it is not at all clear that this is what you have to do.
Metadata
Metadata
Assignees
Labels
No labels