API reference

andrey.metrics.markov_equivalent#

andrey.metrics.markov_equivalent(estimated, true)[source]#

Whether two graphs lie in the same Markov equivalence class (Verma-Pearl 1990).

Two DAGs (or their CPDAGs) are Markov equivalent iff they share the same skeleton and the same set of v-structures (unshielded colliders). Comparing GES / PC output this way lets a discovered CPDAG match any score-equivalent member of its equivalence class – looser than a byte-for-byte adjacency comparison, exactly the invariance a score search is entitled to. Both inputs are read as endpoint marks (a GraphStructure, a StructureOutput, or a raw directed adjacency), so a raw DAG and its essential-graph CPDAG compare equal.

Return type:

bool

Examples

>>> markov_equivalent([[0, 1, 0], [0, 0, 1], [0, 0, 0]], [[0, 0, 0], [1, 0, 1], [0, 0, 0]])
True