Reputation: 141
I am using the neuralnet
package.
I can train using:
neural <- neuralnet(pricelb ~ eight + three + length + diameter + thread,
cleaned, hidden=10, threshold=0.01)`
All of these are numerical features, I double checked with str(cleaned)
However when I go to predict:
prediction <- compute(neural, cleanedtwo)
I get the following error:
Error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments`
It seems usually this is because non numeric values are being used, however I have checked and all the attributes in the training, as well as the same attributes in the test set, are all numerical.
Is there an issue if there are other factor attributes in the dataframes cleaned/cleanedtwo, even if they aren't used in training?
edit: There are also no missing/NA values
Upvotes: 0
Views: 9317
Reputation: 19970
I suspect your cleanedtwo
object has more variables than you specify in the formula (but this is a guess until you show str(cleanedtwo)
.
To address this you can just subset the data to the relevant columns
prediction <- compute(neural, cleanedtwo[, c("eight","three","length","diameter" ,"thread"))
Upvotes: 1