CausalModel.variable
- CausalModel.variable(*args)
Return the variable with the given id or name (observed variables only).
- Parameters:
id_or_name (
int | str) – the node id or name of the variable- Returns:
the discrete variable
- Return type:
- Raises:
pyagrum.NotFound – if the id or name does not correspond to an observed variable in the model
pyagrum.OperationNotAllowed – if the model has no observational BayesNet (built from a DAG).
Example
import pyagrum as gum
bn = gum.fastBN("A{yes|no}->B[3]")
cm = gum.CausalModel(bn)
print(cm.variable("A"))
# A:Labelized({yes|no})
cm.variable(cm.idFromName("B")).labels()
# ('0', '1', '2')
Class