Which part of the code is wrong for artificial neural network in R? [on hold]


Which part of the code is wrong for artificial neural network in R? [on hold]



I'm trying to predict a sales demand by using artificial neural network and 10 fold cross validation.



So, I coded by using nnet package as follows:


library(nnet)
library(plyr)
k = 10
question$id <- sample(1:k, nrow(question), replace = TRUE)
list <- 1:k
prediction <- data.frame()
testsetCopy <- data.frame()
progress.bar <- create_progress_bar("text")
progress.bar$init(k)
for(i in 1:k){
trainingset <- subset(question, id %in% list[-i])
testset <- subset(question, id %in% c(i))
mymodel <- nnet(Sales1~ResidentA+ResidentB+ResidentD+DOW+Weather+Amt_Rainfall+Air_Quality+Avg_Temp+Humidity,
data=trainingset, size=7, decay=0.1)
temp <- as.data.frame(predict(mymodel, testset[,-5]))
prediction <- rbind(prediction, temp)
testsetCopy <- rbind(testsetCopy, as.data.frame(testset[,3]))
progress.bar$step()
}



However, the result showed less than 1 that it seems something wrong.



So May I ask a question how to make it the correct way? (I changed size and decay before but it didn't work)



Thank you.



*here is a sample file link: 1drv.ms/f/s!At97BnO9168kmz68slWFwqPGXDrp



Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.





Please provide enough information encapsulated within the question (avoid external links) to convey your problem clearly and succinctly (see here).
– Roman Luštrik
Jul 1 at 21:54




Popular posts from this blog

How to make file upload 'Required' in Contact Form 7?

Rothschild family

amazon EC2 - How to make wp-config.php to writable?