| compare {bnlearn} | R Documentation |
Compare two different Bayesian networks.
compare(r1, r2, debug = FALSE)
r1 |
an object of class bn. |
r2 |
another object of class bn. |
debug |
a boolean value. If TRUE a lot of debugging output
is printed; otherwise the function is completely silent. |
A boolean value: TRUE if the objects describe the same
network structure, FALSE otherwise.
Marco Scutari
data(learning.test)
res = gs(learning.test)
## the arc between A and B has no direction
plot(res, highlight = c("A", "B"))
res2 = set.arc(res, "A", "B")
compare(res, res2, debug = TRUE)
# * children of A in r1 not present in r2:
# character(0)
# * children of A in r2 not present in r1:
# [1] "B"
# * parents of B in r1 not present in r2:
# character(0)
# * parents of B in r2 not present in r1:
# [1] "A"
# * directed arcs in r1 not present in r2:
# character(0)
# * directed arcs in r2 not present in r1:
# [1] "A -> B"
# * undirected arcs in r1 not present in r2:
# [1] "A - B" "B - A"
# * undirected arcs in r2 not present in r1:
# character(0)
# [1] FALSE