Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xgbTuneGrid = expand.grid(
- nrounds = 10,
- eta = c(0.001, 0.1),
- max_depth = c(2,6),
- gamma = 0,
- colsample_bytree=0.6,
- min_child_weight=1,
- subsample = 0.75
- )
- ctrl <- trainControl(method = "repeatedcv",number = 2,summaryFunction=twoClassSummary,classProbs=TRUE, allowParallel = TRUE)
- xgbtreeModel = train(readmitted ~ raisedhands + Discussion + VisITedResources + AnnouncementsView + activity,
- data = train, method = "xgbTree",tuneGrid = xgbTuneGrid,trainControl = ctrl)
- xgb_prediction <- predict(xgbtreeModel, test)
- xgb_probs <- predict(xgbtreeModel,test,type="prob")
- roc_xgboost =roc(test$readmitted, xgb_probs[,1])
- auc_xgboost = auc(roc_xgboost)
- #plot(roc_xgboost, col = flat_blue, main="ROC curve - xgboost" )
- confusionMatrix(xgb_prediction,test$readmitted)
- cor_xgboost = coords(roc_xgboost,"best", ret=c("accuracy", "sensitivity", "specificity"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement