Kaggle – Santander Customer Satisfaction/Digit Recognizer

Santander Customer Satisfaction

Santander Bank is asking Kagglers to help them identify dissatisfied customers early in their relationship. Doing so would allow Santander to take proactive steps to improve a customer’s happiness before it’s too late.
In this competition, you’ll work with hundreds of anonymized features to predict if a customer is satisfied or dissatisfied with their banking experience.
Library(randomForest)
Library(readr)
test <- read.csv("C:/Users/Liew Keong Han/Desktop/Machine Learning/test – santander.csv")
train <- read.csv("C:/Users/Liew Keong Han/Desktop/Machine Learning/train – santander.csv")
numTrain = 76020
numTrees = 80
rows <- sample(1:nrow(train), numTrain)
TARGET <- as.factor(train[rows,371])
train1 <- train[rows, -371]
rf <- randomForest(train1, TARGET, xtest = test, ntree=numTrees, keep.forest = TRUE, importance = TRUE)
prob <- rf$test$votes
head(prob)
predictions <- data.frame(ID =test$ID, TARGET=prob[,2])
write_csv(predictions, “rf_76020_80-santander.csv”)


Digit Recognizer

The goal in this competition is to take an image of a handwritten single digit, and determine what that digit is. 
test <- read.csv("C:/Users/Liew Keong Han/Desktop/Machine Learning/test – Digit Recognizer.csv")
train <- read.csv("C:/Users/Liew Keong Han/Desktop/Machine Learning/train – Digit Recognizer.csv")
numTrain <- 42000
numTrees <- 80
rows <- sample(1:nrow(train),numTrain)
labels <- as.factor(train[rows, 1])
train <- train[rows, -1]
rf <- randomForest(train, labels, xtest = test , ntree=numTrees)
predictions <- data.frame(ImageId =1:nrow(test), Label=levels(labels)[rf$test$predicted])
head(predictions)
write_csv(predictions, “rf_42000_80-digit_recognizer.csv”)

Related Posts