CPDAG.fromPDAG
- static CPDAG.fromPDAG(pdag)
Checked conversion of a PDAG into a CPDAG: the PDAG must be the CPDAG of its consistent extensions.
- Parameters:
pdag (
pyagrum.PDAG) – a PDAG- Return type:
- Raises:
pyagrum.InvalidArgument – If the PDAG is not a CPDAG.
Example
import pyagrum as gum
cpdag = gum.CPDAG.fromPDAG(gum.fastPDAG("A-B->C<-D"))
print(cpdag)
# {0<A>,1<B>,2<C>,3<D>} , {3->2,1->2} , {0--1}
try:
gum.CPDAG.fromPDAG(gum.fastPDAG("A->B-C")) # A->B is not compelled
accepted = True
except gum.InvalidArgument:
accepted = False
accepted
# False
Used by
