MarkovRandomField.fromBN
- static MarkovRandomField.fromBN(bn)
Create a Markov random field from a Bayesian network.
- Parameters:
bn (
pyagrum.BayesNet) – the Bayesian network to convert- Returns:
a new MRF with the same variables and moralised structure
- Return type:
Example
import pyagrum as gum
bn = gum.fastBN("A->C<-B")
mrf = gum.MarkovRandomField.fromBN(bn)
sorted(mrf.edges()) # A and B are married
# [(0, 1), (0, 2), (1, 2)]
Class