NNWarehouse | R Documentation |
NNWarehosue
class.This is the constructor for the NNWarehouse
class. This produces NeticaNode
objects, which
are instances of the Pnode
abstract class.
NNWarehouse(manifest = data.frame(), session = getDefaultSession(),
key = c("Model","NodeName"), prefix = "V")
manifest |
A data frame containing instructions for building the
nodes. See |
session |
A link to a |
key |
A character vector giving the name of the column in the manifest which contains the network name and the node name. |
prefix |
A character scaler used in front of numeric names to
make legal Netica names. (See |
Each network defines its own namespace for nodes, so the key to the
node manifest is a pair (Model,NodeName) where
Model is the name of the net and NodeName
is the name of
the node.
An object of class NNWarehouse
.
Russell Almond
Warehouse
for the general warehouse protocol.
sess <- NeticaSession()
startSession(sess)
### This tests the manifest and factory protocols.
nodeman1 <- read.csv(system.file("auxdata", "Mini-PP-Nodes.csv",
package="Peanut"),
row.names=1,stringsAsFactors=FALSE)
netman1 <- read.csv(system.file("auxdata", "Mini-PP-Nets.csv",
package="Peanut"),
row.names=1, stringsAsFactors=FALSE)
### Test Net building
Nethouse <- BNWarehouse(manifest=netman1,session=sess,key="Name",
address=system.file("testnets",package="PNetica"))
CM <- WarehouseSupply(Nethouse,"miniPP_CM")
stopifnot(is.null(WarehouseFetch(Nethouse,"PPcompEM")))
EM1 <- WarehouseMake(Nethouse,"PPcompEM")
EMs <- lapply(c("PPcompEM","PPconjEM", "PPtwostepEM", "PPdurAttEM"),
function(nm) WarehouseSupply(Nethouse,nm))
### Test Node Building with already loaded nets
Nodehouse <- NNWarehouse(manifest=nodeman1,
key=c("Model","NodeName"),
session=sess)
phyd <- WarehouseData(Nodehouse,c("miniPP_CM","Physics"))
p3 <- MakePnode.NeticaNode(CM,"Physics",phyd)
phys <- WarehouseSupply(Nodehouse,c("miniPP_CM","Physics"))
stopifnot(p3==phys)
for (n in 1:nrow(nodeman1)) {
name <- as.character(nodeman1[n,c("Model","NodeName")])
if (is.null(WarehouseFetch(Nodehouse,name))) {
cat("Building Node ",paste(name,collapse="::"),"\n")
WarehouseSupply(Nodehouse,name)
}
}
WarehouseFree(Nethouse,PnetName(EM1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.