I have some data, and the Y variable is a factor - good or bad. I create a vector support machine using the train method from the caret package. Using the "train" function, I was able to refine the values ββof various settings and get the final vector support machine. For test data, I can predict the "class". But when I try to predict the probabilities for the test data, I get below errors (for example, my model tells me that the 1st data point in the test data has y = 'good', but I want to know what is the probability of getting a "good", ... in the general case, if the vector machine is supported, the model will calculate the probability of forecasting. If the variable Y has 2 results, then the model will predict the probability of each result. The outcome that has the maximum probability is considered as the final decision)
**Warning message: In probFunction(method, modelFit, ppUnk) : kernlab class probability calculations failed; returning NAs**
code example below
library(caret) trainset <- data.frame( class=factor(c("Good", "Bad", "Good", "Good", "Bad", "Good", "Good", "Good", "Good", "Bad", "Bad", "Bad")), age=c(67, 22, 49, 45, 53, 35, 53, 35, 61, 28, 25, 24)) testset <- data.frame( class=factor(c("Good", "Bad", "Good" )), age=c(64, 23, 50)) library(kernlab) set.seed(231)
a new question below this line: according to the output below there are 9 support vectors. how to recognize from 12 points of training data that are these 9?
svmFit$finalModel
Support for Vector Machine object of class "ksvm"
SV type: C-svc (classification) parameter: value C = 1
Gaussian function of the core of the radial basis. Hyperparameter: sigma = 0.72640759446315
Number of supported vectors: 9
Target function value: -5.6994 Learning error: 0.083333