| query | R Documentation |
Compute conditional probability queries from a sample.
query(sample, event, evidence)
sample |
A |
event |
A expression describing the event of interest |
evidence |
A expression describing the conditioning evidence. |
The conditional probability: P(event|evidence).
data("ecoli", package = "MoTBFs")
dat <- ecoli[,-c(1,4,5,9)]
# Build DAG
dag <- LearningHC(dat)
# Learn BN parameters
bn = motbf.fit(dag, dat)
# Get sample from bn
sam = sample_motbfs(bn, 50)
# Compute P(mcg > 0.6 | aac < 0.8 & alm2 < 0.3)
query(sam, event = (mcg >0.6), evidence = (aac<0.8 & alm2 <0.3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.