NodeKind {RNetica} | R Documentation |
Netica supports nodes of four different kinds: "Nature"
,
"Decision"
, "Utility"
, and "Constant"
. A fifth
kind, "Stub"
is used for a reference to a node when an edge has
been detached from a node. The function NodeKind()
returns the
current kind.
NodeKind(node) NodeKind(node) <- value
node |
A |
value |
A character string with one of the values: |
A "Nature"
node (the default when the node is created) is a
random variable whose value can be predicted using the network. Pure
Bayesian networks use only "Nature"
nodes.
A "Decision"
node is one whose value will be chosen by some
decision maker. A "Utility"
node is one whose value the
decision maker is trying to optimize. A influence diagram contains
decision nodes and utilities in addition to nature nodes. The goal is
implicitly to find a setting of the decision nodes that maximizes the
expected utility.
A "Constant"
node is a parameter used for building a
conditional probability table. Its value is nominally fixed, but it
can be changed to perform sensitivity analysis.
A "Stub"
is a reference to a node created by removing a parent
node from another node without changing the table. It is assumed that
a real node will later be attached in that location. This kind can
only be set internally to Netica; the expression
NodeKind(node) <- "Stub"
will generate an error.
A character vector of length one containing one of the values:
"Nature"
, "Decision"
, "Utility"
,
"Constant"
, or "Stub"
.
Internal to Netica, "Stub"
s are called
DISCONNECTED_NODE
s. I changed the name to make them start with
a unique letter.
Russell Almond
http://norsys.com/onLineAPIManual/index.html: GetNodeKind_bn(), SetNodeKind_bn()
NeticaNode
, is.discrete()
,
NodeParents()
sess <- NeticaSession() startSession(sess) knet <- CreateNetwork("kNet", session=sess) skills <- NewContinuousNode(knet,paste("SkillAtTime",1:2,sep="")) reward <- NewContinuousNode(knet,"RewardForSkill") NodeKind(reward) <- "Utility" placement <- NewDiscreteNode(knet,"Placement",c("Tier1","Tier2","Tier3")) NodeKind(placement) <- "Decision" instructionCost <- NewContinuousNode(knet,"CostOfInstruction") NodeKind(instructionCost) <- "U" pretest <- NewDiscreteNode(knet,"PretestDecision",c("yes","no")) NodeKind(pretest) <- "D" pretestScore <- NewContinuousNode(knet,"PretestScore") NodeKind(pretestScore) <- "Nature" pretestCost <- NewContinuousNode(knet,"PretestCost") NodeKind(pretestCost) <- "u" pretestR <- NewContinuousNode(knet,"PretestReliability") NodeKind(pretestR) <- "Constant" stopifnot( NodeKind(skills[[1]]) == "Nature", NodeKind(skills[[2]]) == "Nature", NodeKind(reward) == "Utility", NodeKind(placement) == "Decision", NodeKind(instructionCost) == "Utility", NodeKind(pretest) == "Decision", NodeKind(pretestScore) == "Nature", NodeKind(pretestCost) == "Utility", NodeKind(pretestR) == "Constant" ) ## To make stub node, need links AddLink(skills[[1]],pretestScore) NodeInputNames(pretestScore) <- "SkillTested" ## Detach node NodeParents(pretestScore)$SkillTested <- list(NULL) stopifnot( NodeKind(NodeParents(pretestScore)$SkillTested) == "Stub" ) DeleteNetwork(knet) stopSession(sess)