BuildTable | 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 then
|
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.
As of version 0.6-2, the meaning of the debug
argument is
changed. In the new version, the
flog.logger
mechanism is used for
progress reports, and error reporting. In particular, setting
flog.threshold(DEBUG)
(or TRACE
)
will cause progress reports to be sent to the logging output.
The debug
argument has been repurposed. It now call
recover
when the error occurs, so that the problem can
be debugged.
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
, PnodeProbs
, PnodeQ
,
PnodePriorWeight
, PnodeRules
,
PnodeLink
, PnodeLnAlphas
,
PnodeAlphas
, PnodeBetas
,
PnodeLinkScale
,GetPriorWeight
,
calcDPCTable
In many implementations, it will be necessary to run
PnetCompile
after building the tables.
## 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),PnodeStates(node),
PnodeLnAlphas(node), PnodeBetas(node),
PnodeRules(node),PnodeLink(node),
PnodeLinkScale(node),PnodeQ(node),
PnodeParentTvals(node))
NodeExperience(node) <- GetPriorWeight(node)
invisible(node)
}
## This is a simplified implementation of BuildAllTables
## (The full implementation adds logging and error handling.)
BuildAllTables <- function (net) {
lapply(PnetPnodes(net),BuildTable)
invisible(net)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.