Learn R Programming

bnlearn (version 0.3)

compare: Compare two different Bayesian networks

Description

Compare two different Bayesian networks.

Usage

compare(r1, r2, debug = FALSE)

Arguments

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.

Value

  • A boolean value: TRUE if the objects describe the same network structure, FALSE otherwise.

Examples

Run this code
data(learning.test)

res = gs(learning.test)
# the arc between E and F has no direction
plot(res, highlight = c("E", "F"))
res2 = choose.direction(res, c("E", "F"), learning.test)
plot(res, highlight = c("E", "F"))
compare(res, res2, debug = TRUE)
# * arcs in r1 not present in r2:
# [1] "F -> E"
# * arcs in r2 not present in r1:
# character(0)
# [1] FALSE

Run the code above in your browser using DataLab