简体   繁体   中英

Testing Neural Network with Continuous Output in R

Trying to use the neuralnet package in calculating the continuous output and apply it to my testset to calculate error rate.

However, my predicted output seems to be the same.

m1 <- neuralnet(SalaryNormalized ~ factor1 + factor2 + factor3, 
            data=GC_train, hidden=2, err.fct="sse", linear.output=TRUE,stepmax=1e6)

GC_test1<-GC_test
GC_test1$SalaryNormalized<-NULL
res$net.result

my results show all of the same value, I understand that scaling might be required when using continuous variables on the neuralnet package. Does my predicted variable requires scaling too?

res <- neuralnet::compute(m1, GC_test1)
testset.error <- GC_test$SalaryNormalized - res

Additionally, i tried to calculate the error and got this error

Error in GC_test$SalaryNormalized - res : 
non-numeric argument to binary operator

You can ues it

sigmoid = function(x) {1 / (1 + exp(-x))}

nn <- neuralnet(X06.Offset + X16.Offset ~ Mold.temp + Hot.Runner.temp + Holding.pressure + Holding.time +Injection.speed ,data=train_,hidden=c(2,3), linear.output=T,act.fct = sigmoid , learningrate = 0.01, threshold = 0.01, stepmax = 5e7)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM