BayesNet.addVariables

BayesNet.addVariables(listFastVariables, default_nbr_mod=2)

Add a list of variable in the form of ‘fast’ syntax.

Parameters:
  • listFastVariables (list[str]) – the list of variables in ‘fast’ syntax.

  • default_nbr_mod (int) – the number of modalities for the variable if not specified following fast syntax. Note that default_nbr_mod=1 is mandatory to create variables with only one modality (for utility for instance).

Returns:

the list of created ids.

Return type:

list[int]

Example

import pyagrum as gum

bn = gum.BayesNet()
bn.addVariables(["A", "B[3]", "C{low|high}"])
# [0, 1, 2]
print(bn.variable("B"))
# B:Range([0,2])

Class

BayesNet