Reputation: 1053
I'm trying to create a simple Neural Network in R using the nerualnet package. Instead of typing out all 784 input variables I am just using a . like is suggested in this thread: neural network using all input variables?
But I am getting this error
> digitnet <- neuralnet(label ~ ., trainingset, hidden = 4)
Error in terms.formula(formula) : '.' in formula and no 'data' argument
Upvotes: 3
Views: 1120
Reputation: 37879
I don't know why that doesn't work but you can always use the following:
myform <- as.formula(paste0('label ~ ',
paste(names(trainingset[!names(trainingset) %in% 'label']),
collapse = ' + ')))
and then:
digitnet <- neuralnet(myform, trainingset, hidden = 4)
And it will use all 784 input variables in the neural network model.
Upvotes: 2