Home > Back-end >  How to get the continuous probability from SVM prediction
How to get the continuous probability from SVM prediction

Time:02-12

I have trained a binary SVM classifier and made predictions like the following:

classifier = svm(formula = type ~ .,
                 data = train,
                 type = 'C-classification',
                 kernel = 'polynomial')
y_pred = predict(classifier, newdata = test[1:57])

The label that I am training against (type) is a factor. The prediction (y_pred) in this case is also a factor list. How can I obtain the probability/logits of these predictions so that I can produce a ROC curve?

CodePudding user response:

You should do a regression.

type = 'C-regression', 

CodePudding user response:

I disagree with suggestions you should do a regression. Classification is appropriate for this task, and you can specify that you want probabilities rather then binary predictions when you make the predictions:

y_pred = predict(classifier, newdata = test[1:57], probability=TRUE)
  • Related