[R] can not print probabilities in svm of e1071

Saeed Abu Nimeh sabunime at gmail.com
Fri Apr 30 01:49:51 CEST 2010


 svm.model <- svm(y~.,data=dataset,probability=TRUE)
 svm.pred<-predict(svm.model, test.set, decision.values = TRUE,
probability = TRUE)
 library(ROCR)
 svm.roc <- prediction(attributes(svm.pred)$decision.values, test.set)
 svm.auc <- performance(svm.roc, 'tpr', 'fpr')
 plot(svm.auc)


On Thu, Apr 29, 2010 at 4:17 PM, Changbin Du <changbind at gmail.com> wrote:
>> x <- train[,c( 2:18, 20:21, 24, 27:31)]
>> y <- train$out
>>
>> svm.pr <- svm(x, y, probability = TRUE, method="C-classification",
> kernel="radial", cost=bestc, gamma=bestg, cross=10)
>>
>> pred <- predict(svm.pr, valid[,c( 2:18, 20:21, 24, 27:31)],
> decision.values = TRUE, probability = TRUE)
>>      attr(pred, "decision.values")[1:4,]
>        16         23         43         52
> 1.08157648 0.51241842 0.06234319 1.20656580
>>      attr(pred, "probabilities")[1:4,]
> NULL
>
>
> HI, Dear David and R community,
>
> I am trying to print out the probabilities and set a threshold for make ROC
> curve.  I dont know  why  it showed NULL for the probabilities.
>
> y<-train$out, is consisting of 0 and 1 binary values.
>
> Can you help me with this?
>
> Thanks so much!
>
>
>
> --
> Sincerely,
> Changbin
> --
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list