Hi
you need predict.ksvm() function.
for more information see The kernlab package here:
http://lib.stat.cmu.edu/R/CRAN/doc/packages/kernlab.pdf
cheers,
Amir
Muhammad Subianto <msubianto@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@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.
---------------------------------
[[alternative HTML version deleted]]