Advertisement
Guest User

Untitled

a guest
May 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. xgbTuneGrid = expand.grid(
  2. nrounds = 1000,
  3. eta = c(0.01,0.1),
  4. max_depth = c(2,6,10),
  5. gamma = 0,
  6. colsample_bytree=0.6,
  7. min_child_weight=1,
  8. subsample = 0.75
  9. )
  10. ctrl <- trainControl(method = "repeatedcv",number = 5,summaryFunction=twoClassSummary,classProbs=TRUE, allowParallel = TRUE)
  11.  
  12. xgbtreeModel = train(readmitted ~., data = train, method = "xgbTree",tuneGrid = xgbTuneGrid,trainControl = ctrl)
  13. xgbtreeModel$resample
  14. xgbtreeModel$results
  15.  
  16. xgb_prediction <- predict(xgbtreeModel, test)
  17. roc_xgboost =roc(test$readmitted, xgb.probs[,1])
  18. plot(roc_xg, col = flat_blue, main="ROC curve - tree" )
  19. confusionMatrix(xgb_prediction,test$readmitted)
  20. cor_xgboost = coords(roc_xg,"best", ret=c("accuracy", "sensitivity", "specificity"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement