[R] Creating a simple neural network with AMORE

Wee-Jin Goh wjgoh at brookes.ac.uk
Sun Nov 5 20:39:12 CET 2006

Greetings list,

Is there a way of creating a simple feedforward neural network with  
AMORE? I know this is possible using the "neural" package, but that  
package is rather slow compared to AMORE.

It seems that AMORE needs a vector that contains the number of  
neurons in the input, output *and* hidden layer. I've tried placing 0  
as the number of neurons in the hidden layer but that resulted in  
bringing down R :(.

Perhaps I'm doing something wrong?


p.s. Simple sample code that should demonstrate the problem.

inputs <- matrix(0, 4, 2)
inputs[,1] <- c(-1, -1, 1, 1)
inputs[,2] <- c(-1, 1, -1, 1)
target <- matrix(0, 4, 1)
target[,1] <- c(-1, 1, 1, -1)

#replace n.neurons=c(2,3,1) if we want a network with 3 hidden units.
net <- newff(n.neurons=c(2,0,1), learning.rate.global=0.1,
			momentum.global=0.5, error.criterium="LMS", Stao=NA,
			hidden.layer="tansig", output.layer="tansig", method="ADAPTgdwm")

result <- train(net, inputs, target, error.criterium="LMS",
				report=TRUE, show.step=50, n.shows=5)
y <- sim(result$net, inputs)

More information about the R-help mailing list