SnnsR-class(RSNNS)
SnnsR-class()所属R语言包:RSNNS
The main class of the package
主类的包
译者:生物统计家园网 机器人LoveR
描述----------Description----------
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
S4类是主类的RSNNS。这一类的每个实例都包含一个指向一个C + +对象的类型SnnsCLib的,即一个实例
Details
详细信息----------Details----------
The only slot variables holds an environment with all member variables. Currently, there are two members (constructed by the object factory):
仅插槽variables持有的所有成员变量的环境中。目前,有两个成员(构建对象工厂):
snnsCLibPointer A pointer to the corresponding C++ object
snnsCLibPointer相应的C + +对象的指针
serialization a serialization of the C++ object, in SNNS .net format
净格式的C + +对象序列化的序列化,的SNNS。
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$...
包中的所有车型在内部使用这个类的对象。是总是访问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
为了使充分利用的SNNS功能,您可能要直接使用这个类。请务必使用对象工厂SnnsRObjectFactory来构造一个对象,并调用机制$打检测功能。通过调用机制,目前许多功能,SnnsCLib是,这里没有记录,但在用户手册的SNNS。所以,如果你选择使用低级别的接口,它是强烈建议有
参考文献----------References----------
参见----------See Also----------
$, SnnsRObjectFactory
$,SnnsRObjectFactory
实例----------Examples----------
## Not run: demo(art1_lettersSnnsR)[#不运行:演示(art1_lettersSnnsR)]
## Not run: demo(art2_tetraSnnsR) [#不运行:演示(art2_tetraSnnsR)]
## Not run: demo(artmap_lettersSnnsR) [#不运行:演示(artmap_lettersSnnsR)]
## Not run: demo(eight_elmanSnnsR)[#不运行:演示(eight_elmanSnnsR)]
## Not run: demo(rbf_irisSnnsR)[#不运行:演示(rbf_irisSnnsR)]
## Not run: demo(rbf_sinSnnsR)[#不运行:演示(rbf_sinSnnsR)]
## Not run: demo(rbfDDA_spiralsSnnsR)[#不运行:演示(rbfDDA_spiralsSnnsR)]
## Not run: demo(som_cubeSnnsR)[#不运行:演示(som_cubeSnnsR)]
#This is the demo eight_elmanSnnsR[这是演示eight_elmanSnnsR的]
#Here, we train an Elman network[在这里,我们训练的Elman网络]
#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()
snnsObject$saveNet(paste(basePath,"eight_elmanSnnsR_untrained.net",sep=""),
"eight_elmanSnnsR_untrained")
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")
snnsObject$saveNet(paste(basePath,"eight_elmanSnnsR.net",sep=""),
"eight_elmanSnnsR")
snnsObject$saveNewPatterns(paste(basePath,"eight_elmanSnnsR.pat",sep=""),
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|