Solution: kernlab class probability calculations failed; returning NAs
Howdy! I’m putting this down here for my future reference, as well as for anyone who has spent the couple hours looking for a solution:
kernlab class probability calculations failed; returning NAs
You get this error because you need to use a formula to define your model. For example:
fit.svm.radial <- train(data.train[,!(names(data.train) %in% c('value_change'))], data.train$value_change,
method='svmRadial',
trControl=objControl,
metric = "ROC",
tunegrid=tunegrid,
preProcess = NULL
)
needs to be changed to:
fit.svm.radial <- train(value_change~., data=data.train,
method='svmRadial',
trControl=objControl,
metric = "ROC",
tunegrid=tunegrid,
preProcess = NULL
)
If you found this helpful, let me know in the commentary section below 🙂