Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(gbm)
library(caret)
library(ranger)
setwd("c:/users/Matt/Dropbox/DataScienceBootcamp/Projects/MachineLearning/Santander/")
train_standardized$response = ifelse(train_standardized$response==0,"NO","YES")
params = expand.grid(eta = seq(0.5,1,.1), colsample_bytree= seq(0,1,.5),
nrounds=seq(500,1000,250), max_depth = seq(5,10,1),
min_child_weight=1,gamma=0)
gbmGrid <- expand.grid(interaction.depth = c(1, 5, 9),
n.trees = seq(100,500,100),
shrinkage = 0.1,
n.minobsinnode = 20)
train.boost = train(x=train_standardized[,-length(train_standardized)], y=train_standardized$response,
method = "ranger",
metric = "ROC",
maximize = FALSE,
tuneLength = 5,
trControl = trainControl(method="cv",
number=5,
classProbs = TRUE,
verboseIter = TRUE,
summaryFunction = twoClassSummary,savePredictions = TRUE))
#Make test set predictions (after Test data is preprocessed)
preds <- predict(train.boost,newdata=test_standardized,type="prob")
submission <- data.frame(ID=test.id, TARGET=preds[2])
write.csv(submission, "xxx.csv",row.names=F,quote=F)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.