PnetMakeStubNodes | R Documentation |
A stub node is a reference in a spoke network to a node
in a hub network. The function PnetMakeStubNodes
makes
stub nodes in the spoke network. The function RemoveStubNodes
removes them.
PnetMakeStubNodes(net, nodes)
PnetRemoveStubNodes(net, nodes)
net |
A |
nodes |
A list of |
In the hub-and-spoke model, spoke models (evidence models) reference
nodes in the central hub model (proficiency model in educational
applications). The stub node is a node (or pseudo-node) in the
spoke model which is actually a reference to a node in the hub model.
In the operation PnetAdjoin
when the spoke model is
combined with the hub model, the stubs are replaced with the actual
nodes they represent.
The pair of functions PnetMokeStubNodes
and
PnetRemoveStubNodes
are used inside of Qmat2Pnet
to create the necessary references to the proficiency nodes (in the
columns of the Q
-matrix) while building the conditional
probability tables for the observable nodes (the rows of the
Q
-matrix). The function PnetMakeStubNodes
gets called
before the conditional probability tables are built, and the function
PnetRemoveStubNodes
gets called after all conditional
probability tables are built.
The function PnetMakeStubNodes
returns a list of the newly
created stub nodes.
The return of the function PnetRemoveStubNodes
is
implementation dependent, and is called mainly for its side effects.
Both functions destructively modify the net
argument.
The behavior of these functions will depend a lot on the underlying
implementation, and they should be thought of as a pair. The function
PnetMakeStubNodes
gets called before constructing the
conditional probability tables, and PnetRemoveStubNodes
. For
example, this could be used to give the nodes the official hub node
name while constructing the conditional probability tables and then
rename them to something else.
In the PNetica-package
implementation, the
function PnetMakeStubNodes
copies the nodes from the hub to the
spoke, and the function PnetRemoveStubNodes
deletes them (which
if they are attached as a parent, automatically creates a stub node in
Netica).
Russell Almond
Almond, R. G. (presented 2017, August). Tabular views of Bayesian networks. In John-Mark Agosta and Tomas Singlair (Chair), Bayeisan Modeling Application Workshop 2017. Symposium conducted at the meeting of Association for Uncertainty in Artificial Intelligence, Sydney, Australia. (International) Retrieved from http://bmaw2017.azurewebsites.net/
PnetHub(spoke)
give the name of the hub node for a
given spoke.
The function PnetAdjoin(hub,spoke)
merges
hub and spoke networks replacing the stubs with the originals in the
hub network.
The function Qmat2Pnet
uses PnetMakeStubNodes
and
PnetRemoveStubNodes
internally.
## Not run:
library(PNetica) ## Needs PNetica
sess <- NeticaSession()
startSession(sess)
PM <- ReadNetworks(system.file("testnets", "miniPP-CM.dne",
package="PNetica"), session=sess)
EM1 <- ReadNetworks(system.file("testnets", "PPcompEM.dne",
package="PNetica"), session=sess)
## Find the target node and its parents.
obs <- PnetFindNode(EM1,"CompensatoryObs")
pars <- PnetFindNode(PM,c("NTL","POfMom"))
## Make stub nodes for the parents
stubs <- PnetMakeStubNodes(EM1,pars)
## Set them as the parents
PnodeParents(obs) <- stubs
## Build the CPT
PnodeLink(obs) <- "partialCredit"
PnodeRules(obs) <- "Compensatory"
PnodeAlphas(obs) <- c(NTL=0.9,POfMom=1.1)
PnodeBetas(obs) <- 0.3
PnodeQ(obs) <- TRUE
BuildTable(obs)
##Done, now remove the stubs
PnetRemoveStubNodes(EM1,stubs)
DeleteNetwork(list(PM,EM1))
stopSession(sess)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.