BayesNetFragment.jointProbability

BayesNetFragment.jointProbability(i)
Parameters:

i (pyagrum.Instantiation) – an instantiation of the variables

Returns:

a parameter of the joint probability for the BayesNet

Return type:

float

Warning

a variable not present in the instantiation is assumed to be instantiated to 0

Example

import pyagrum as gum

bn = gum.fastBN("A->B->C")
bn.cpt("A").fillWith([0.2, 0.8])
bn.cpt("B").fillWith([0.9, 0.1, 0.3, 0.7])
fragment = gum.BayesNetFragment(bn)
fragment.installAscendants("B")
inst = fragment.completeInstantiation()
inst.chgVal("A", 1)
round(fragment.jointProbability(inst), 4)  # P(A=1, B=0)
# 0.24

Class

BayesNetFragment