MakePnode.NeticaNode: Makes a Pnode which is also a Netica Node

MakePnode.NeticaNodeR Documentation

Makes a Pnode which is also a Netica Node

Description

This does the actual work of making a node from a warehose manifest. It is typically called from WarehouseMake.

Usage

MakePnode.NeticaNode(net, name, data)

Arguments

net

A NeticaBN object in which the node will be created.

name

The name of the node. Ideally, this should follow the Netica IDname rules.

data

A data.frame with one for each state of contains data and meta-data about the node and states (See details).

Details

This is a key piece of the Warehouse infrastructure. If a node of the designated name does not exist, it will be created. If it does exist, the metadata fields of the node will be adjusted to match the fields in the data object.

Some of the fields of the data object apply to the whole node. In these fields, the value in the first row is used and the rest are ignored.

NStates

A integer giving the number of states for a discrete variable or the discritzation of a continuous one. The number of rows of the data frame should match this.

Continuous

A logical value telling whether or not the node should be regarded as continuous.

NodeTitle

This is a longer unconstrained name for the node.

NodeDescription

This is a longer string describing the node.

NodeLabels

This is a comma separated list of tags identifying sets to which the node belongs. See PnodeLabels.

These fields are repeated for each of the states in the node, as they are different for each state.

StateName

The name of the state, this should follow the Netica IDname conventions.

StateTitle

This is a longer unconstrained name for the state.

StateDescription

This is a longer string describing the state.

Additionally, the following field is used only for discrete nodes:

StateValue

This is a numeric value assigned to the state. This value is used when calculating the node expected value.

The StateValue plays two important roles. First, when used with the PnodeEAP and PnodeSD functions, it is the value assigned to the node. Second, when constructing CPTs using the DiBello framework, it is used at the effective thetas. See PnodeParentTvals and PnodeStateValues

Continuous nodes in Netica are handled by breaking the interval up into pieces. This is the function PnodeStateBounds. Note that the bounds should be either monotonically increasing or decreasing and that the lower bound for one category should match lower bound for the next to within a tolerance of .002. The values Inf and -Inf can be used where appropriate.

LowerBound

This is a numeric value giving the lower bound for the range for the discritization of the node.

UpperBound

This is a numeric value giving the upper bound for the range for the

Value

An object of class NeticaNode which is also in the Pnode abtract class.

Names and Truenames

The truename system is designed to implement the name restrictions inherent in Netica (see IDname) without imposing the same limits on the Peanut framework. This is done by adding a Truename field to the net object and then mangling the actual name to follow the Netica rules using the as.IDname function.

The object should be available from the warehouse via its truename, but it is best to stick to the Netica naming conventions for networks and nodes.

Note that the truename convention is used for node names, but not for state names, which are restricted to Netica conventions.

Author(s)

Russell Almond

See Also

RNetica Package: NeticaNode, NewContinuousNode, NewDiscreteNode, IDname

Peanut Package: Warehouse, WarehouseMake

PNetica Pacakge PnodeWarehouse

Examples

sess <- NeticaSession()
startSession(sess)

### This tests the manifest and factory protocols.

netman1 <- read.csv(system.file("auxdata", "Mini-PP-Nets.csv", 
                                 package="Peanut"),
                    row.names=1, stringsAsFactors=FALSE)
## Build the first network (proficiency model)
miniPP <- MakePnet.NeticaBN(sess,"miniPP",netman1[1,,drop=FALSE])

nodeman1 <- read.csv(system.file("auxdata", "Mini-PP-Nodes.csv", 
                                 package="Peanut"),
                     row.names=1,stringsAsFactors=FALSE)

## Discrete Example
phys.dat <- nodeman1[nodeman1$NodeName=="Physics",]

Physics <- MakePnode.NeticaNode(miniPP,"Physics",phys.dat)

## Continuous Example
dur.dat <- nodeman1[nodeman1$NodeName=="Duration",]

Duration <- MakePnode.NeticaNode(miniPP,"Duration",dur.dat)


DeleteNetwork(miniPP)
stopSession(sess)


ralmond/PNetica documentation built on Sept. 19, 2023, 8:27 a.m.