API reference

andrey.metrics.causal_order_scores#

andrey.metrics.causal_order_scores(order, true_dag)[source]#

Accuracy, Kendall tau, and comparable-pair count of an order against a true DAG.

accuracy is the fraction of true ancestral pairs the order sequences correctly; kendall_tau is 2 * accuracy - 1 over those comparable pairs; n_comparable_pairs is how many ancestral pairs exist (so tau and accuracy carry distinct information). A valid topological order scores accuracy 1.0; an order with no comparable pairs scores 1.0 / tau 1.0.

Return type:

dict[str, float]

Examples

>>> causal_order_scores([0, 1, 2], [[0, 1, 0], [0, 0, 1], [0, 0, 0]])["accuracy"]
1.0