Skip to content

Instantly share code, notes, and snippets.

@Yankim
Created September 19, 2016 13:32
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/d2c9ab1cba4709b3e3d184afda715345 to your computer and use it in GitHub Desktop.
Save Yankim/d2c9ab1cba4709b3e3d184afda715345 to your computer and use it in GitHub Desktop.
#Predicting the test data
xgmat.test <- xgb.DMatrix(as.matrix(higgs.test.dummy))
xgboostTestPred <- predict(bst, newdata=xgmat.test)
predicted <- rep("s",550000)
predicted[xgboostTestPred>=threshold] <- "b"
weightRank = rank(xgboostTestPred, ties.method= "random")
write.csv(as.data.frame(xgboostTestPred), "Submissions/xgboost_prob.csv")
write.csv(as.data.frame(higgs.testId), "Submissions/EventID.csv")
submission = data.frame(EventId = higgs.testId, RankOrder = weightRank, Class = predicted)
write.csv(submission, "xgboost_submission.csv", row.names=FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment