[R] Using AMORE package for NN
kgorahava at gmail.com
kgorahava at gmail.com
Mon Aug 16 05:52:48 CEST 2010
Hi,
I am running the AMORE package functions in R to compare the MSE given by R , with the results I am getting by running my Professors algorithm in Matlab. The code I am using in R is given below. I have one file which has 125 observations to be used for training the NN and one file with 125 observations to use for testing the NN. In each file there are four input variables and one output variable. I have limited the number of iterations to 100 just as in my Professors algorithm.
My doubt is, how come I am getting such a small value of MSE (e0) when actually I am expecting it to be higher as the MSE values by my Professors algorithm (which is supposed to be more superior)?
Is there a mistake I am making in the below code ?
+++++++++++++++++++++++++++++++++++++++++++++++++++++
traindata=read.table(file="C:/xyInventory-4dim-OA3.dat", header=FALSE, sep="")
testdata=read.table(file="C:/xyInventory-4dim-HSS.dat", header=FALSE, sep="")
X0 = traindata[1:125, 1:4 ]
Y0=traindata[1:125, 5]
Xtest=testdata[1:125, 1:4]
Ytest=testdata[1:125, 5]
Nh=25
net0=newff(n.neurons=c(4,Nh,1), learning.rate.global=1e-2, momentum.global=0.5, error.criterium="LMS", Stao=NA, hidden.layer="tansig", output.layer="purelin", method="ADAPTgdwm")
net1 = train (net0, as.matrix(X0), as.matrix(Y0), error.criterium="LMS", report=TRUE, show.step=20, n.shows=5)
Yhat0 = sim (net1$net, Xtest)
e0= sqrt(sum((Ytest- Yhat0)^2)/length(Ytest))
e0
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Any advice on how to get the value of the MSE directly in R?
What will happen if Xtest and Ytest are replaced by as.matrix(X0) and as.matrix(Y0) in the above code?
Please help me t figure out.
Thanks in advance.
More information about the R-help
mailing list