Description Usage Arguments Value Examples
This function queries the Bayesian network and returns the probabilities for each
state of the target node. Available input variables are set as evidence.
queryNetParallel
works as queryNet
, but makes use of multi cores/processors facilities
for big network queries, by splitting data into chunks and processing them in parallel.
1 2 3 |
network |
The Bayesian network. An object of class |
target |
character. The node of interest to be modelled and mapped. |
evidence |
matrix or data.frame. Named columns are the known input variables; rows are the discrete states associated to them for each record (NA allowed). |
... |
Additional arguments to force one or more nodes to a state (i.e. fixing evidence). If the node is associated to any input spatial data, the latter will be ignored, thus resulting spatially equal everywhere. Node name must be provided as argument and the associated fixed state as character; both node and state names must be typed exactly as their names in the network. |
inparallel |
logical or integer. Number of cores to be used by |
A matrix of probabilities: columns are the states of the target node and rows are the probabilities
associated to each record (i.e. spatial locations) from evidence
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | list2env(ConwyData, environment())
network <- LandUseChange
q <- queryNet(network, 'FinalLULC', evidence)
head(q)
## Fix a given node on a state (i.e. fixed evidence) by providing an additional argument
q <- queryNet(network, 'FinalLULC', evidence, Stakeholders = 'farmers')
head(q)
## Fix evidence for two nodes, including one of the spatial inputs (i.e. overriden by evidence)
q <- queryNet(network, 'FinalLULC', evidence, Stakeholders = 'farmers', CurrentLULC = 'forest')
head(q)
## For a programmatic approach, the arguments could be passed as named list:
# lst <- list(Stakeholders = 'farmers', CurrentLULC = 'forest')
# queryNet(network, 'FinalLULC', evidence, lst)
## Use parallel processing
q <- queryNetParallel(network, 'FinalLULC', evidence, inparallel=2)
head(q)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.