BayesNet.addAND
- BayesNet.addAND(var)
Add a variable, it’s associate node and an AND implementation.
The id of the new variable is automatically generated.
- Parameters:
variable (
pyagrum.DiscreteVariable) – The variable added by copy.var (
DiscreteVariable)
- Returns:
the id of the added variable.
- Return type:
int- Raises:
pyagrum.SizeError – If variable.domainSize()>2
Example
import pyagrum as gum
bn = gum.fastBN("A;B")
bn.addAND(gum.LabelizedVariable("C", "A and B", 2))
# 2
bn.addArcs([("A", "C"), ("B", "C")])
bn.cpt("C")[{"A": 1, "B": 1}].tolist()
# [0.0, 1.0]
bn.cpt("C")[{"A": 1, "B": 0}].tolist()
# [1.0, 0.0]
Class