StructuralMetrics.sid
- StructuralMetrics.sid(*args)
Compute the Structural Intervention Distance (SID) between two DAGs.
SID [1] counts the number of ordered pairs (i, j) for which the parent-adjustment set for the causal effect of i on j in the reference graph is incorrectly reproduced by the test graph.
Properties:
sid(G, G) == 0If G ⊆ H (all parents of G are parents of H), then
sid(G, H) == 0.SID is asymmetric:
sid(G, H) != sid(H, G)in general.
Two overloads are available:
sid(DAG, DAG)— operates directly on DAG objects.sid(BayesNet, BayesNet)— nodes matched by variable name; the comparison runs on the underlying DAGs after name-based alignment.
- Parameters:
ref – Reference DAG or BayesNet.
test – DAG or BayesNet to evaluate against the reference.
- Returns:
The SID value (non-negative integer returned as float).
- Return type:
float- Raises:
pyagrum.OperationNotAllowed – If the graphs have different sizes.
pyagrum.InvalidNode – If a variable present in ref is absent from test (BayesNet overload only).
Example
import pyagrum as gum
ref = gum.fastDAG("A->B->C")
test = gum.fastDAG("A->B;A->C;B->C") # a supergraph of ref
sm = gum.StructuralMetrics()
sm.sid(ref, test)
# 0.0
sm.sid(test, ref) # SID is not symmetric
# 1.0
Class