Titanic random forest learning -0.76555

# This R script will run on our backend. You can write arbitrary code here! # Many standard libraries are already installed, such as randomForest library(randomForest) #Load required packages library(‘data.table’) library(‘rpart’) library(‘rpart.plot’) library(‘randomForest’) library(‘FSelector’) #Load data, convert datatypes, binarization, descritization and dummy columns train <- data.table(read.csv(“../input/train.csv”)) class(train) str(train) train[,IsSurvived := Survived==1] train[,Pclass := as.factor(Pclass)] train[,IsChild := NA] train[,IsChild := Age 0 ] train[,HasSbl := ifelse(HasSbl,’yes’,’no’)] train[,HasSbl := as.factor(HasSbl)] train[,HasPrch := Parch > 0 ] train[,HasPrch := ifelse(HasPrch,’yes’,’no’)] train[,HasPrch := as.factor(HasPrch)] train[,FareCat:=ifelse(Fare 14.45 & Fare 32 , ‘H’,NA)))] train[,FareCat := as.factor(FareCat)] train[,table(FareCat)] formulaRpart <- formula(‘IsSurvived~Sex+IsChild+HasSbl+HasPrch+Embarked+Pclass+FareCat’) tree <- rpart(formula=formulaRpart, data=train) prp(tree) #not much useful information dfGains <- information.gain(IsSurvived~.,train) summary(train$Fare) #revisit decision tree with new fare category column formulaRpart <- formula(‘IsSurvived~Sex+IsChild+HasSbl+HasPrch+Embarked+Pclass+FareCat’) tree <- rpart(formula=formulaRpart, data=train) prp(tree) #apply random forest index <- sample( x=c(TRUE,…


Link to Full Article: Titanic random forest learning -0.76555