• Please complete the contact form below with details about your inquiry and I'll get back to you as soon as possible.

  • This field is for validation purposes and should be left unchanged.

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
                )

Happy training!

Leave a Reply

Your email address will not be published. Required fields are marked *