Converts a Knowledge object to a list of two data frames, namely
whitelist and blacklist, which can be used as arguments for
bnlearn algorithms. The whitelist contains all required edges, and the
blacklist contains all forbidden edges. Tiers will be made into forbidden
edges before running the conversion.
Value
A list with two elements, whitelist and blacklist, each a data
frame containing the edges in a from, to format.
See also
Other knowledge functions:
+.Knowledge(),
add_exogenous(),
add_tier(),
add_to_tier(),
add_vars(),
as_pcalg_constraints(),
as_tetrad_knowledge(),
convert_tiers_to_forbidden(),
deparse_knowledge(),
forbid_edge(),
get_tiers(),
knowledge(),
knowledge_to_caugi(),
remove_edge(),
remove_tiers(),
remove_vars(),
reorder_tiers(),
reposition_tier(),
require_edge(),
seq_tiers(),
unfreeze()
Examples
# produce whitelist/blacklist data frame for bnlearn
data(tpc_example)
kn <- knowledge(
tpc_example,
tier(
child ~ starts_with("child"),
youth ~ starts_with("youth"),
oldage ~ starts_with("old")
),
child_x1 %-->% youth_x3
)
bnlearn_kn <- as_bnlearn_knowledge(kn)
print(bnlearn_kn)
#> $whitelist
#> from to
#> 1 child_x1 youth_x3
#>
#> $blacklist
#> from to
#> 1 oldage_x5 child_x1
#> 2 oldage_x5 child_x2
#> 3 oldage_x5 youth_x3
#> 4 oldage_x5 youth_x4
#> 5 oldage_x6 child_x1
#> 6 oldage_x6 child_x2
#> 7 oldage_x6 youth_x3
#> 8 oldage_x6 youth_x4
#> 9 youth_x3 child_x1
#> 10 youth_x3 child_x2
#> 11 youth_x4 child_x1
#> 12 youth_x4 child_x2
#>
