andrey.metrics.to_cpdag#
- andrey.metrics.to_cpdag(graph)[source]#
Canonicalize a DAG to its CPDAG (essential graph); CPDAG/PAG inputs pass through unchanged.
Comparing MEC-identified graphs (PC / GES / …) through their CPDAG lets a DAG and any score-equivalent member of its Markov equivalence class score identically. A
digraph(directed, cyclic) has no essential graph and raises.- Return type:
Examples
>>> import numpy as np >>> to_cpdag(np.array([[0, 1], [0, 0]])).kind # a lone edge is unorientable 'cpdag'