## create kernel object for normalized spectrum kernel
specK5 <- spectrumKernel(k=5)
## load data
data(TFBS)
## select 70% of the samples for training and the rest for test
train <- sample(1:length(enhancerFB), length(enhancerFB) * 0.7)
test <- c(1:length(enhancerFB))[-train]
## perform training - feature weights are computed by default
model <- kbsvm(enhancerFB[train], yFB[train], specK5, pkg="LiblineaR",
svm="C-svc", cost=15)
preddec <- predict(model, enhancerFB[test], predictionType="decision")
rocdata <- computeROCandAUC(preddec, yFB[test], allLabels=unique(yFB))
## accessor for auc
auc(rocdata)
Run the code above in your browser using DataLab