BayesNet.variableFromName

BayesNet.variableFromName(name)

Return the variable with the given name.

Parameters:

name (str) – the name of the variable

Returns:

the variable

Return type:

pyagrum.DiscreteVariable

Raises:

pyagrum.NotFound – if no variable with this name exists in the model

Example

import pyagrum as gum

bn = gum.fastBN("A->B{yes|no|maybe}")
v = bn.variableFromName("B")
v.labels()
# ('yes', 'no', 'maybe')

Class

BayesNet