SnnsR-class

0th

Percentile

The main class of the package

An S4 class that is the main class of RSNNS. Each instance of this class contains a pointer to a C++ object of type SnnsCLib, i.e. an instance of the SNNS kernel.

Details

The only slot variables holds an environment with all member variables. Currently, there are two members (constructed by the object factory):

snnsCLibPointer

A pointer to the corresponding C++ object

serialization

a serialization of the C++ object, in SNNS .net format

The member variables are not directly present as slots but wrapped in an environment to allow for changing the serialization (by call by reference).

An object of this class is used internally by all the models in the package. The object is always accessible by model$snnsObject$...

To make full use of the SNNS functionalities, you might want to use this class directly. Always use the object factory SnnsRObjectFactory to construct an object, and the calling mechanism $ to call functions. Through the calling mechanism, many functions of SnnsCLib are present that are not documented here, but in the SNNS User Manual. So, if you choose to use the low-level interface, it is highly recommended to have a look at the demos and at the SNNS User Manual.

References

Zell, A. et al. (1998), 'SNNS Stuttgart Neural Network Simulator User Manual, Version 4.2', IPVR, University of Stuttgart and WSI, University of T<U+00FC>bingen. http://www.ra.cs.uni-tuebingen.de/SNNS/welcome.html

See Also

$, SnnsRObjectFactory

Aliases
  • SnnsR-class
Examples
# NOT RUN {
demo(encoderSnnsCLib)
# }
# NOT RUN {
demo(art1_lettersSnnsR)
# }
# NOT RUN {
demo(art2_tetraSnnsR)
# }
# NOT RUN {
demo(artmap_lettersSnnsR)
# }
# NOT RUN {
demo(eight_elmanSnnsR)
# }
# NOT RUN {
demo(rbf_irisSnnsR)
# }
# NOT RUN {
demo(rbf_sinSnnsR)
# }
# NOT RUN {
demo(rbfDDA_spiralsSnnsR)
# }
# NOT RUN {
demo(som_cubeSnnsR)
# }
# NOT RUN {

#This is the demo eight_elmanSnnsR
#Here, we train an Elman network
#and save a trained and an untrained version
#to disk, as well as the used training data

basePath <- ("./")

data(snnsData)

inputs <- snnsData$eight_016.pat[,inputColumns(snnsData$eight_016.pat)]
outputs <- snnsData$eight_016.pat[,outputColumns(snnsData$eight_016.pat)]

snnsObject <- SnnsRObjectFactory()

snnsObject$setLearnFunc('JE_BP')
snnsObject$setUpdateFunc('JE_Order')
snnsObject$setUnitDefaults(1,0,1,0,1,'Act_Logistic','Out_Identity')

snnsObject$elman_createNet(c(2,8,2),c(1,1,1),FALSE)


patset <- snnsObject$createPatSet(inputs, outputs)
snnsObject$setCurrPatSet(patset$set_no)

snnsObject$initializeNet(c(1.0,  -1.0,  0.3,  1.0,  0.5) )
snnsObject$shufflePatterns(TRUE)
snnsObject$DefTrainSubPat()

# }
# NOT RUN {
snnsObject$saveNet(paste(basePath,"eight_elmanSnnsR_untrained.net",sep=""),
                                          "eight_elmanSnnsR_untrained")
# }
# NOT RUN {
parameters <- c(0.2, 0, 0, 0, 0)
maxit <- 1000

error <- vector()
for(i in 1:maxit) {
  res <- snnsObject$learnAllPatterns(parameters)
  if(res[[1]] != 0) print(paste("Error at iteration ", i, " : ", res, sep=""))
  error[i] <- res[[2]]
}

error[1:500]
plot(error, type="l")

# }
# NOT RUN {
snnsObject$saveNet(paste(basePath,"eight_elmanSnnsR.net",sep=""),
                                             "eight_elmanSnnsR")
# }
# NOT RUN {
snnsObject$saveNewPatterns(paste(basePath,"eight_elmanSnnsR.pat",sep=""), 
                                                         patset$set_no)
# }
Documentation reproduced from package RSNNS, version 0.4-12, License: LGPL (>= 2) | file LICENSE

Community examples

Looks like there are no examples yet.