[Amore-commits] R access to AMORE networks
Manuel Castejón Limas
manuel.castejon at unileon.es
Mon Jul 25 12:28:05 CEST 2011
Dear all,
We have gained access from the R terminal to the AMORE C++ classes.
Now, it's only a matter of writing a few lines of code for the predict and
train methods.
Greetings
Manuel
incCode <- paste(readLines( "pkg/AMORE/src/AMORE.h"), collapse = "\n" )
testCode <- ""
testCodefun <- cfunction(sig=signature(), body=testCode,includes=incCode,
otherdefs="using namespace Rcpp;", language="C++", verbose=FALSE,
convention=".Call",Rcpp=TRUE,cppargs=character(), cxxargs=
paste("-I",getwd(),"/pkg/AMORE/src -I/opt/local/include",sep=""),
libargs=character())
modAMORE <- Module("mod_AMORE", getDynLib(testCodefun))
AMOREnet <- modAMORE$NetworkRinterface
net <- new (AMOREnet)
net$show()
# Uninitialized network. Please use any of the create methods available.
net$createFeedForwardNetwork(c(3,4,5,2)) # This one should be improve to
accept an arbitrary couple of activation functions --- a piece of cake
net$show()
#
#
# =========================================================
# Input Layer
# =========================================================
#
# -----------------------------------
# Id: 1
# -----------------------------------
# output: 0.000000
# -----------------------------------
#
# -----------------------------------
# Id: 2
# -----------------------------------
# output: 0.000000
# -----------------------------------
#
# -----------------------------------
# Id: 3
# -----------------------------------
# output: 0.000000
# -----------------------------------
#
# =========================================================
# Hidden Layers
# =========================================================
#
# -----------------------------------
# Id: 4
# -----------------------------------
# bias: 0.075957
# output: 0.000000
# -----------------------------------
# From: 1 Weight= 0.066707
# From: 2 Weight= -0.206484
# From: 3 Weight= -0.105587
# -----------------------------------
#
# -----------------------------------
# Id: 5
# -----------------------------------
# bias: -0.078118
# output: 0.000000
# -----------------------------------
# From: 1 Weight= 0.029251
# From: 2 Weight= 0.092108
# From: 3 Weight= 0.120308
# -----------------------------------
#
# -----------------------------------
# Id: 6
# -----------------------------------
# bias: -0.072798
# output: 0.000000
# -----------------------------------
# From: 1 Weight= 0.212599
# From: 2 Weight= 0.228965
# From: 3 Weight= 0.103189
# -----------------------------------
#
# -----------------------------------
# Id: 7
# -----------------------------------
# bias: -0.076561
# output: 0.000000
# -----------------------------------
# From: 1 Weight= 0.031377
# From: 2 Weight= -0.090947
# From: 3 Weight= 0.004679
# -----------------------------------
#
# -----------------------------------
# Id: 8
# -----------------------------------
# bias: 0.208192
# output: 0.000000
# -----------------------------------
# From: 4 Weight= 0.206423
# From: 5 Weight= 0.129576
# From: 6 Weight= 0.145507
# From: 7 Weight= 0.061925
# -----------------------------------
#
# -----------------------------------
# Id: 9
# -----------------------------------
# bias: 0.061735
# output: 0.000000
# -----------------------------------
# From: 4 Weight= 0.027846
# From: 5 Weight= -0.159941
# From: 6 Weight= 0.193446
# From: 7 Weight= -0.149098
# -----------------------------------
#
# -----------------------------------
# Id: 10
# -----------------------------------
# bias: -0.059627
# output: 0.000000
# -----------------------------------
# From: 4 Weight= 0.092017
# From: 5 Weight= 0.226942
# From: 6 Weight= 0.075113
# From: 7 Weight= -0.224416
# -----------------------------------
#
# -----------------------------------
# Id: 11
# -----------------------------------
# bias: -0.081444
# output: 0.000000
# -----------------------------------
# From: 4 Weight= -0.036672
# From: 5 Weight= 0.155313
# From: 6 Weight= -0.062914
# From: 7 Weight= -0.126029
# -----------------------------------
#
# -----------------------------------
# Id: 12
# -----------------------------------
# bias: -0.151271
# output: 0.000000
# -----------------------------------
# From: 4 Weight= 0.229607
# From: 5 Weight= 0.210131
# From: 6 Weight= -0.010589
# From: 7 Weight= -0.194893
# -----------------------------------
#
# =========================================================
# Output Layer
# =========================================================
#
# -----------------------------------
# Id: 13
# -----------------------------------
# bias: 0.097918
# output: 0.000000
# -----------------------------------
# From: 8 Weight= 0.107296
# From: 9 Weight= -0.171640
# From: 10 Weight= -0.051762
# From: 11 Weight= 0.039894
# From: 12 Weight= 0.123288
# -----------------------------------
#
# -----------------------------------
# Id: 14
# -----------------------------------
# bias: 0.136566
# output: 0.000000
# -----------------------------------
# From: 8 Weight= 0.083047
# From: 9 Weight= -0.129915
# From: 10 Weight= -0.102014
# From: 11 Weight= -0.059982
# From: 12 Weight= -0.193560
# -----------------------------------
# =========================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/amore-commits/attachments/20110725/42deffd3/attachment-0001.htm>
More information about the Amore-commits
mailing list