# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 0.6.2
#     language: julia
#     name: julia-0.6
# ---

using BayesNets

bn = DiscreteBayesNet()
push!(bn, DiscreteCPD(:a, [1/3, 1/3, 1/3]))
push!(bn, DiscreteCPD(:b, [1/3, 1/3, 1/3]))
push!(bn, DiscreteCPD(:c, [:a, :b], [3,3], 
        [Categorical([0,1/2,1/2]), #A=0, B=0
        Categorical([0,0,1]), #A=0, B=1
        Categorical([0,1,0]), #A=0, B=2
        Categorical([0,0,1]), #A=1, B=0
        Categorical([1/2,0,1/2]), #A=1, B=1
        Categorical([1,0,0]), #A=1, B=2
        Categorical([0,1,0]), #A=2, B=0
        Categorical([1,0,0]), #A=2, B=1
        Categorical([1/2,1/2,0]) #A=2, B=2
        ]))

# +
assignment = Assignment(:b => 1, :c => 2)

infer(bn, :a, evidence=assignment)

StarcoderdataJupyterScriptsDedupFiltered