Comparing causal networks
Other examples have showcased how to compare Bayesian networks as probabilitistic models, focusing on graphical differences and equivalence classes. None of these approaches is useful in determining how different two networks are when interpreted as causal models.
bnlearn implements the sid()
measure of causal divergence, the causal analogue of
shd()
. Similarly to shd()
, it takes two networks learned
and true
and evaluates the former taking the latter as ground truth.
> learned = model2network("[A][C][F][B|A][D|A:C][E|B:F]") > true = model2network("[A][C][F][B|A][D|A:C][E|F]") > sid(learned, true)
[1] 0 attr(,"bounds") [1] 0 0
When both learned
and true
are DAGs, sid()
returns a single value (their
divergence). When either network is a CPDAG, the SID value is computed for each DAG in the equivalence class it
represents using cextend.all()
. When both networks are CPDAGs, sid()
computes the divergence
for all combinations of DAGs from the respective equivalence classes.
> sid(cpdag(learned), true)
[1] 0 3 attr(,"bounds") [1] 0 3
> sid(learned, cpdag(true))
[1] 2 0 4 2 attr(,"bounds") [1] 0 4
> sid(cpdag(learned), cpdag(true))
[1] 2 5 0 3 4 2 2 0 attr(,"bounds") [1] 0 5
In addition, sid()
will always attach to its return value the lower and upper bound of the computed SID
values, for compatibility with the reference implementation provided by package sid.
Tue Aug 5 22:36:24 2025
with bnlearn
5.1
and R version 4.5.0 (2025-04-11)
.