title: AUC metrics on XGBoost
body: <p>I build my model for prediction with XGBoost:</p>
  
  <pre><code>setDT(train)
  setDT(test)
  
  labels &lt;- train$Goal
  ts_label &lt;- test$Goal
  new_tr &lt;- model.matrix(~.+0,data = train[,-c("Goal"),with=F]) 
  new_ts &lt;- model.matrix(~.+0,data = test[,-c("Goal"),with=F])
  
  labels &lt;- as.numeric(labels)-1
  ts_label &lt;- as.numeric(ts_label)-1
  
  dtrain &lt;- xgb.DMatrix(data = new_tr,label = labels) 
  dtest &lt;- xgb.DMatrix(data = new_ts,label=ts_label)
  
  params &lt;- list(booster = "gbtree", objective = "binary:logistic", eta=0.3, gamma=0, max_depth=6, min_child_weight=1, subsample=1, colsample_bytree=1)
  
  xgb1 &lt;- xgb.train(params = params, data = dtrain, nrounds = 291, watchlist = list(val=dtest,train=dtrain), print_every_n = 10, 
                     early_stop_round = 10, maximize = F , eval_metric = "error")
  
  
  xgbpred &lt;- predict(xgb1,dtest)
  xgbpred &lt;- ifelse(xgbpred &gt; 0.5,1,0)
  
  confusionMatrix(xgbpred, ts_label)
  
  Confusion Matrix and Statistics
  
            Reference
  Prediction    0    1
           0 1904   70
           1  191 2015
  
                 Accuracy : 0.9376               
                   95% CI : (0.9298, 0.9447)     
      No Information Rate : 0.5012               
      P-Value [Acc &gt; NIR] : &lt; 0.00000000000000022
  
                    Kappa : 0.8751               
   Mcnemar's Test P-Value : 0.0000000000001104   
  
              Sensitivity : 0.9088               
              Specificity : 0.9664               
           Pos Pred Value : 0.9645               
           Neg Pred Value : 0.9134               
               Prevalence : 0.5012               
           Detection Rate : 0.4555               
     Detection Prevalence : 0.4722               
        Balanced Accuracy : 0.9376               
  
         'Positive' Class : 0   
  </code></pre>
  
  <p>This accuracy suits me, but I want to check the metric of auc. I write:</p>
  
  <pre><code>xgb1 &lt;- xgb.train(params = params, data = dtrain, nrounds = 291, watchlist = list(val=dtest,train=dtrain), print_every_n = 10, 
                     early_stop_round = 10, maximize = F , eval_metric = "auc")  
  </code></pre>
  
  <p>But after that i don't know how to make a prediction concerning AUC metrics. I need your help, because its my first experience with XGBoost. Thanks.</p>
  
  <p>UPD: As far as I understand, after the auc metric I need a coefficient that I will cut classes. Now I cut off in 0,5</p>