BayesNet.variable

BayesNet.variable(*args)
Parameters:
  • id (int) – a variable’s id

  • name (str) – a variable’s name

Returns:

the variable

Return type:

pyagrum.DiscreteVariable

Raises:

pyagrum.NotFound – If the graph does not contain the variable

Example

import pyagrum as gum

bn = gum.fastBN("A->B{yes|no|maybe}")
print(bn.variable("B"))
# B:Labelized({yes|no|maybe})
bn.variable(0).name()
# 'A'

Class

BayesNet