[R] How to find AUC in SVM (kernlab package)
Muhammad Subianto
msubianto at gmail.com
Fri Nov 24 17:25:12 CET 2006
On this day 11/24/2006 05:03 PM, Amir Safari wrote:
> Hi
> you need predict.ksvm() function.
>
Yes, like this is below I do to predict (kernlab package,
http://www.jstatsoft.org/v11/i09/v11i09.pdf):
pima.pred <- predict(pimamodel, Pima.te[,-8], type="probabilities")
pima.pred
My problems is how to find AUC (with ROCR package, or other ROC
functions) from predict above.
Regards, Muhammad Subianto
> for more information see The kernlab package here:
> http://lib.stat.cmu.edu/R/CRAN/doc/packages/kernlab.pdf
>
> cheers,
> Amir
>
>
> */Muhammad Subianto <msubianto at gmail.com>/* wrote:
>
> Dear all,
> I was wondering if someone can help me. I am learning SVM for
> classification in my research with kernlab package. I want to know
> about
> classification performance using Area Under Curve (AUC). I know ROCR
> package can do this job but I found all example in ROCR package have
> include prediction, for example, ROCR.hiv {ROCR}. My problem is
> how to
> produce prediction in SVM and to find AUC.
>
> Here is a simple example:
>
> library(MASS)
> library(kernlab)
> library(ROCR)
>
> pimamodel <- ksvm(type ~
> .,data=Pima.tr,type="C-svc",C=10,prob.model=TRUE)
> pimamodel
> fitted(pimamodel)
>
> pima.pred <- predict(pimamodel, Pima.te[,-8], type="probabilities")
> pima.pred
>
> # try to find AUC
> #predid.no <- prediction(pima.pred[,1], Pima.te[,8])
> #predid.yes <- prediction(pima.pred[,2], Pima.te[,8])
> predid <- prediction(pima.pred, Pima.te[,8])
> perfid <- performance(predid,"tpr","fpr")
> perfid.auc <- performance(predid,"auc")
> perfid.auc
>
> Thank you very much for your help.
>
> Best wishes, Muhammad Subianto
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
>
> ------------------------------------------------------------------------
> Cheap Talk? Check out
> <http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> Yahoo! Messenger's low PC-to-Phone call rates.
More information about the R-help
mailing list