title: How to use ROC for choosing best model parameters using caret package?
body: <p>I'm trying to build an glm model based on caret package.I would like to use the ROC for choosing the best classification model's parameters.I added <code>summaryFunction=twoClassSummary</code> and <code>classProbs = TRUE</code> to the <code>trainControl</code> function and
  <code>metric = "ROC"</code> to the <code>train</code> function.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>library('caret')
  
  dat &lt;- read.table(text = " target birds    wolfs     snakes
  +       0        3        9         7
  +       1        3        8         4
  +       1        1        2         8
  +       0        1        2         3
  +       0        1        8         3
  +       1        6        1         2
  +       0        6        7         1
  +       1        6        1         5
  +       0        5        9         7
  +       1        3        8         7
  +       1        4        2         7
  +       0        1        2         3
  +       0        7        6         3
  +       1        6        1         1
  +       0        6        3         9
  +       1        6        1         1   ",header = TRUE)
  </code></pre>
  
  <p>The control function:</p>
  
  <pre><code> fitControl &lt;- trainControl( method = "repeatedcv",  number = 10,repeats = 10, summaryFunction=twoClassSummary,classProbs = TRUE)
  </code></pre>
  
  <p>The model:</p>
  
  <pre><code>glm &lt;- train(target~ ., data = dat, method = "glm", trControl = fitControl, tuneLength = 4, metric = "ROC")
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code> Error in evalSummaryFunction(y, wts = weights, ctrl = trControl, lev = classLevels,  : 
    train()'s use of ROC codes requires class probabilities. See the classProbs option of trainControl()
  In addition: Warning message:
  In train.default(x, y, weights = w, ...) :
    cannnot compute class probabilities for regression
  </code></pre>
  
  <p>What am I'm doing wrong?</p>