View source: R/knowledge-conversions.R
| as_bnlearn_knowledge | R Documentation |
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.
as_bnlearn_knowledge(kn)
kn |
A |
A list with two elements, whitelist and blacklist, each a data
frame containing the edges in a from, to format.
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()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.