Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xgbTuneGrid = expand.grid(
- nrounds = 1000,
- eta = c(0.01,0.1),
- max_depth = c(2,6,10),
- gamma = 0,
- colsample_bytree=0.6,
- min_child_weight=1,
- subsample = 0.75
- )
- ctrl <- trainControl(method = "repeatedcv",number = 5,summaryFunction=twoClassSummary,classProbs=TRUE, allowParallel = TRUE)
- xgbtreeModel = train(readmitted ~., data = train, method = "xgbTree",tuneGrid = xgbTuneGrid,trainControl = ctrl)
- xgbtreeModel$resample
- xgbtreeModel$results
- xgb_prediction <- predict(xgbtreeModel, test)
- roc_xgboost =roc(test$readmitted, xgb.probs[,1])
- plot(roc_xg, col = flat_blue, main="ROC curve - tree" )
- confusionMatrix(xgb_prediction,test$readmitted)
- cor_xgboost = coords(roc_xg,"best", ret=c("accuracy", "sensitivity", "specificity"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement