causaldag.classes.dag.DAG.permutation_score¶
-
DAG.permutation_score(order: list) → int[source]¶ Return the number of “errors” in
orderwith respect to the DAG, i.e., the number of times thati->``j`` in the DAG buticomes afterjinorder.Parameters: order – the order to check. Examples
>>> import causaldag as cd >>> g = cd.DAG(arcs={(1, 2), (1, 3)}) >>> g.permutation_score([1, 2, 3]) 0 >>> g.permutation_score([2, 1, 3]) 1 >>> g.permutation_score([2, 3, 1]) 2