Created
March 31, 2016 20:25
-
-
Save sriyoda/74d5951fc8272362bb6a361776305850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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