Learn R Programming

bnstruct (version 1.0.6)

belief.propagation: perform belief propagation.

Description

Perform belief propagation for the network of an InferenceEngine, given a set of observations when present. In the current version of bnstruct, belief propagation can be computed only over a junction tree.

Usage

belief.propagation(ie, observations = NULL, return.potentials = FALSE)

# S4 method for InferenceEngine belief.propagation(ie, observations = NULL, return.potentials = FALSE)

Arguments

ie

an InferenceEngine object.

observations

list of observations, consisting in two vector, observed.vars for the observed variables, and observed.vals for the values taken by variables listed in observed.vars. If no observations are provided, the InferenceEngine will use the ones it already contains.

return.potentials

if TRUE only the potentials are returned, instead of the default BN.

Value

updated InferenceEngine object.

Examples

Run this code
# NOT RUN {
dataset <- BNDataset("file.header", "file.data")
bn <- BN(dataset)
ie <- InferenceEngine(bn)
ie <- belief.propagation(ie)

observations(ie) <- list("observed.vars"=("A","G","X"), "observed.vals"=c(1,2,1))
belief.propagation(ie)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab