Following the example reported in the link below I have the following error:
Using nnet for prediction, am i doing it right?
Error in na.fail.default(list(y = c(0, 0.0998334166468282, 0.198669330795061, : missing values in object
To solve this error I use the condition na.action = na.omit
#Fit model
model <- train(y ~ x1 + x2, te, method='nnet', linout=TRUE, trace = FALSE,
#Grid of tuning parameters to try:
tuneGrid=expand.grid(.size=c(1,5,10),.decay=c(0,0.001,0.1)),
na.action = na.omit)
ps <- predict(model, te)
is.na(te)
nrow(te)
nrow(ps)
Is this condition the only way to proceed?
In fact the consequence is that the number of rows of the ps is different to the number of ps data.