MarkovRandomField.variables
- MarkovRandomField.variables(*args)
Return the variables of the model: all of them, or those corresponding to a list of names or to a set of node ids.
- Parameters:
args (
list[str]orset[int], optional) – variable names or node ids (all the variables of the model if absent)- Returns:
the corresponding variables
- Return type:
set[pyagrum.DiscreteVariable]- Raises:
pyagrum.NotFound – If a name or an id is not the one of a variable of the model.
Example
import pyagrum as gum
mrf = gum.fastMRF("A--B;B--C")
sorted(v.name() for v in mrf.variables())
# ['A', 'B', 'C']
sorted(v.name() for v in mrf.variables({mrf.idFromName("A"), mrf.idFromName("C")}))
# ['A', 'C']
Class