title: Plotting Roc Curve in SVM
body: <p>I am trying to create a ROC curve for an SVM and here is the code I have used :</p>
  
  <pre><code>#learning from training
  #tuned &lt;- tune.svm(y~., data=train, gamma = 10^(-6:-1), cost = 10^(1:2))
  summary(tuned)
  
  
  svmmodel&lt;-svm(y~., data=train, method="C-classification",
                kernel="radial", gamma = 0.01, cost = 100,cross=5, probability=TRUE) 
  
  svmmodel
  
  #predicting the test data
  svmmodel.predict&lt;-predict(svmmodel,subset(test,select=-y),decision.values=TRUE)
  svmmodel.probs&lt;-attr(svmmodel.predict,"decision.values")
  svmmodel.class&lt;-predict(svmmodel,test,type="class")
  svmmodel.labels&lt;-test$y
  #analyzing result
  svmmodel.confusion&lt;-confusion.matrix(svmmodel.labels,svmmodel.class)
  svmmodel.accuracy&lt;-prop.correct(svmmodel.confusion)
  
  #roc analysis for test data
  svmmodel.prediction&lt;-prediction(svmmodel.probs,svmmodel.labels)
  svmmodel.performance&lt;-performance(svmmodel.prediction,"tpr","fpr")
  svmmodel.auc&lt;-performance(svmmodel.prediction,"auc")@y.values[[1]]
  </code></pre>
  
  <p>but the problem that the curve ROC is somthing like this : </p>
  
  <p><a href="https://i.stack.imgur.com/G1NBR.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G1NBR.gif" alt="enter image description here"></a></p>