BuildTable {Peanut} | R Documentation |
The function BuildTable
builds the conditional probability
table for a Pnode
object, and sets the prior weight for
the node using the current values of parameters. It sets these in the
Bayesian network object as appropriate for the implementation. The
expression BuildAllTables(net)
builds tables for all of the
nodes in PnetPnodes(net)
.
BuildTable(node) BuildAllTables(net, debug=FALSE)
node |
A |
net |
A |
debug |
A logical scalar. If true the names of the nodes are printed as each one is built to help determine where errors are occuring. |
The fields of the Pnode
object correspond to the
arguments of the calcDPCTable
function. The
output conditional probability table is then set in the node object in
an implementation dependent way. Similarly, the current value of
GetPriorWeight
is used to set the weight that the prior
table will be given in the EM algorithm.
The node
or net
argument is returned invisibly.
As a side effect the conditional probability table and prior weight of
node
(or a collection of nodes) is modified.
The function BuildTable
is an abstract generic function, and it
needs a specific implementation. See the
PNetica-package
for an example.
Russell Almond
Almond, R. G. (2015) An IRT-based Parameterization for Conditional Probability Tables. Paper presented at the 2015 Bayesian Application Workshop at the Uncertainty in Artificial Intelligence Conference.
Pnode
, PnodeQ
,
PnodePriorWeight
, PnodeRules
,
PnodeLink
, PnodeLnAlphas
,
PnodeAlphas
, PnodeBetas
,
PnodeLinkScale
,GetPriorWeight
,
calcDPCTable
## Not run: ## This is the implementation of BuildTable in Netica. The [[<- and ## NodeExperience functions are part of the RNetica implementation. BuildTable.NeticaNode <- function (node) { node[] <- calcDPCFrame(ParentStates(node),NodeStates(node), PnodeLnAlphas(node), PnodeBetas(node), PnodeRules(node),PnodeLink(node), PnodeLinkScale(node),PnodeQ(node), PnodeParentTvals(node)) NodeExperience(node) <- GetPriorWeight(node) invisible(node) } ## This is the implementation of BuildAllTables BuildAllTables <- function (net) { lapply(PnetPnodes(net),BuildTable) invisible(net) } ## End(Not run)