I'm trying to do simple neural network modelling, but the NNet result gives me poor result. It is simply ' output = 0.5 x input ' model that I want nnet model to learn, but the prediction shows all '1' as a result. What is wrong?
library(neuralnet)
traininginput <- as.data.frame(runif(50,min=1,max=100))
trainingoutput <- traininginput/2
trainingdata<-cbind(traininginput,trainingoutput)
colnames(trainingdata)<-c("Input","Output")
net.sqrt2 <- nnet(trainingdata$Output~trainingdata$Input,size=0,skip=T, linout=T)
Testdata<-as.data.frame(1:50)
net.result2<-predict(net.sqrt2, Testdata)
cleanoutput2 <- cbind(Testdata,Testdata/2,as.data.frame(net.result2))
colnames(cleanoutput2)<-c("Input2","Expected Output2","Neural Net Output2")
print(cleanoutput2)