BayesNet.minimalCondSet
- BayesNet.minimalCondSet(targets, list)
Returns, given one or many targets and a list of variables, the minimal set of those needed to calculate the target/targets.
- Parameters:
target (
int) – The id of the targettargets (
listofint) – The ids of the targetslist (
listofint) – The list of available variables
- Returns:
The minimal set of variables
- Return type:
set
Example
import pyagrum as gum
bn = gum.fastBN("A->B->C->D;E->C")
bn.minimalCondSet(bn.idFromName("D"), bn.ids(["A", "B", "C", "E"])) # C is enough to compute D
# {2}
bn.minimalCondSet(bn.idFromName("D"), bn.ids(["A", "B", "E"]))
# {1, 4}
Class