Skip to content

Instantly share code, notes, and snippets.

@Yankim
Created September 19, 2016 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yankim/98090929cb099360602b10be2f838975 to your computer and use it in GitHub Desktop.
Save Yankim/98090929cb099360602b10be2f838975 to your computer and use it in GitHub Desktop.
#Predicting training data
xgmat.train <- xgb.DMatrix(as.matrix(higgs.train.dummy),
label = as.numeric(higgs.labels == "X0"),
weight = scaled.weight)
xgboostTrainPred <- predict(bst, newdata = xgmat.train)
labels <- ifelse(as.character(higgs.labels)=="X1", 1, 0)
auc = roc(labels, xgboostTrainPred)
plot(auc, print.thres=TRUE)
######## From the graph, we can tell the best threshold is 0.002
threshold <- 0.662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment