BayesNetFragment.variable

BayesNetFragment.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->C<-D;C->E")
fragment = gum.BayesNetFragment(bn)
fragment.installAscendants("C")  # A, B, C, D
print(fragment.variable("C"))
# C:Range([0,1])

Class

BayesNetFragment