I have never been able to get class probabilities to work and I am relatively new to using these tools, and I am looking for some insight as to what may be wrong.
I am using caret with kernlab/ksvm. I will simplify my problem to a basic data set which produces the same problem. I have read the caret vignettes as well as documentation for ?train. I appreciate any direction you can give. I realize this is a very small dataset, the actual data is much larger, I am just using 10 rows as an example: trainset <- data.frame( outcome=factor(c("0","1","0","1","0","1","1","1","1","0")), age=c(10, 23, 5, 28, 81, 48, 82, 23, 11, 9), amount=c(10.11, 22.23, 494.2, 2.0, 29.2, 39.2, 39.2, 39.0, 11.1, 12.2) ) > str(trainset) 'data.frame': 7 obs. of 3 variables: $ outcome: Factor w/ 2 levels "0","1": 2 1 2 2 2 2 1 $ age : num 23 5 28 48 82 11 9 $ amount : num 22.2 494.2 2 39.2 39.2 ... > colSums(is.na(trainset)) outcome age amount 0 0 0 ## SAMPLING AND FORMULA dataset <- trainset index <- 1:nrow(dataset) testindex <- sample(index, trunc(length(index)*30/100)) trainset <- dataset[-testindex,] testset <- dataset[testindex,-1] ## TUNE caret / kernlab set.seed(1) MyTrainControl=trainControl( method = "repeatedcv", number=10, repeats=5, returnResamp = "all", classProbs = TRUE ) ## MODEL rbfSVM <- train(outcome~., data = trainset, method="svmRadial", preProc = c("scale"), tuneLength = 10, trControl=MyTrainControl, fit = FALSE ) There were 50 or more warnings (use warnings() to see the first 50) > warnings() Warning messages: 1: In train.default(x, y, weights = w, ...) : At least one of the class levels are not valid R variables names; This may cause errors if class probabilities are generated because the variables names will be converted to: X0, X1 2: In caret:::predictionFunction(method = method, modelFit = mod$fit, ... : kernlab class prediction calculations failed; returning NAs ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.