model.to.structure {bnviewer} | R Documentation |
Model to Bayesian Network Structure
Description
Creates a Bayesian Network structure based on a high level semantic model.
Usage
model.to.structure(model)
Arguments
model |
Model string |
References
See online documentation http://robsonfernandes.net/bnviewer
Examples
library(bnlearn)
library(bnviewer)
model.left.arrow.op1 = " A <- (B,C,D);
B <- (E,F);
F <- (G);
"
model.left.arrow.op2 = " A <= (B,C,D);
B <= (E,F);
F <= (G);
"
model.right.arrow.op1 = " A -> (B,C,D);
B -> (E,F);
F -> (G);
"
model.right.arrow.op2 = " A => (B,C,D);
B => (E,F);
F => (G);
"
structure = model.to.structure(model.left.arrow.op1)
viewer(structure,
bayesianNetwork.width = "100%",
bayesianNetwork.height = "80vh",
bayesianNetwork.layout = "layout_on_grid",
node.colors = list(background = "#f4bafd",
border = "#2b7ce9",
highlight = list(background = "#97c2fc",
border = "#2b7ce9"))
)
data.set = bnlearn::gaussian.test
bayesianNetwork.fit = bn.fit(structure, data = data.set)
print(bayesianNetwork.fit$A)
[Package bnviewer version 0.1.6 Index]