1
$\begingroup$

My svm classifier model always predict 0.5 as probabilities.

svm.model <- svm(repeater ~ idRepeatBuyRatio + idTotalPurchase + c + d, data = trainData, cost = 100, gamma = 1)

svm.pred <- predict(svm.model, testData, probability = TRUE)
head(attr(svm.pred, "probabilities"))
    t   f
1 0.5 0.5
2 0.5 0.5
3 0.5 0.5
4 0.5 0.5
5 0.5 0.5
6 0.5 0.5

which is strange because the same call without probabilities actually makes different classifications:

> svm.pred <- predict(svm.model, testData, probability = FALSE)
> head(svm.pred)
1 2 3 4 5 6 
f t f t f f 
Levels: f t

Can someone explain what I am doing wrong?

$\endgroup$
1
  • 1
    $\begingroup$ can you post an example of your dataset so we can try to reproduce it. $\endgroup$
    – mike1886
    Commented Jun 23, 2014 at 17:12

1 Answer 1

2
$\begingroup$

The default value for probability in the svm function is FALSE. If you set this to TRUE then you ought to get the results you want.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.