0

I am using the SVM method of machine learning. When I used the model to make prediction on test dataset, I got all NAs. I think the issue is from kernlab. How could I deal with this? Any suggestions will be much appreciated. Thanks

library(e1071)
library(kernlab)

model_svm<-train(nzv[index,], trainSet.y, method='svmRadial', trControl=fitControl, tuneLength=6)

testSet$model_svm <- predict(model_svm, testSet)

testSet$model_svm <- predict(model_svm, testSet)
Warning message:
In method$predict(modelFit = modelFit, newdata = newdata, submodels = param) :
  kernlab class prediction calculations failed; returning NAs

testSet$model_svm 
 [1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
[25] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
Levels: N Y
UseR10085
  • 7,120
  • 3
  • 24
  • 54
rthapa
  • 1
  • 2
  • Including sample data using the `dput(head(x))` function will help others answer your question. More here on making a [reproducible minimal example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – ravic_ Nov 20 '19 at 17:42
  • My data is very big so I couldn't paste the output of dput(head(x)). I used the same script for a small dataset with 5 features and 20 response variables and it did run successfully. But the same script throws an error with the big dataset. I am not able to find a solution. – rthapa Nov 20 '19 at 22:44
  • do you have any NAs in your dataset? or any characters? you can check using ```str(dataframe)``` – PleaseHelp May 20 '20 at 22:40

0 Answers0