MarkovRandomField.variable

MarkovRandomField.variable(*args)

Return the variable associated with a given node id.

Parameters:

id (int) – the node id

Returns:

the variable

Return type:

pyagrum.DiscreteVariable

Raises:

pyagrum.NotFound – if the node id does not exist

Example

import pyagrum as gum

mrf = gum.fastMRF("A--B;B--C")
print(mrf.variable("B"))
# B:Range([0,1])
mrf.variable(0).name()
# 'A'

Class

MarkovRandomField