Advertisement
Guest User

Untitled

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