Skip to content

Strange error with ROCR

5 messages · Christian Schulz, Tobias Sing, Noah Silverman

#
Hi,

you need  the score value , have a look at ?svm.predict and in the ROCR 
example.

traindata <- as.data.frame(matrix(runif(1000),ncol=10))
trainlabels <-  
as.factor(sample(c("win","lose"),nrow(data),replace=T,prob=c(0.5,0.5)))

model <- svm(traindata,trainlabels, type="C-classification", 
kernel="radial", cost=10,
class.weights=c("win"=3,"lose"=1), scale=FALSE, probability = TRUE)

prediction <- predict(model, traindata, decision.values = TRUE, 
probability = TRUE)
probs <-  attr(prediction, "probabilities")[,1]
pred <- prediction(probs,trainlabels)

HTH Christian
#
Since AFAIK they are related by a monotonous transformation, both
approaches should lead to the same ROC curve, shouldn't they? (not
tested)
On Tue, Aug 4, 2009 at 8:14 PM, Noah Silverman<noah at smartmediacorp.com> wrote: