MPDAG.fromPDAG
- static MPDAG.fromPDAG(pdag)
Checked conversion of a PDAG into an MPDAG: the PDAG must be extendable and closed under the Meek rules.
- Parameters:
pdag (
pyagrum.PDAG) – a PDAG- Return type:
- Raises:
pyagrum.InvalidArgument – If the PDAG is not an MPDAG.
Example
import pyagrum as gum
mpdag = gum.MPDAG.fromPDAG(gum.fastPDAG("A-B->C->D"))
print(mpdag)
# {0<A>,1<B>,2<C>,3<D>} , {2->3,1->2} , {0--1}
try:
gum.MPDAG.fromPDAG(gum.fastPDAG("A-B->C-D")) # C-D should be oriented by the Meek rules
accepted = True
except gum.InvalidArgument:
accepted = False
accepted
# False
Class