Why am I getting this warning message when performing a randomForest to predict the Survived column in Titanic dataset (code to follow)?
In randomForest.default(m, y, …) :
The response has five or fewer unique values. Are you sure you want to do regression?
titanic.data <- titanic.data[, -c(1, 4, 9, 11)]
titanic.data$Age[is.na(titanic.data$Age)] <- median(titanic.data$Age, na.rm=TRUE)
titanic.data$Fare[is.na(titanic.data$Fare)] <- median(titanic.data$Fare, na.rm=TRUE)
set.seed(27)
train.index <- sample(1:nrow(titanic.data), 0.7*nrow(titanic.data))
titanic.train <- titanic.data[train.index,]
titanic.test <- titanic.data[-train.index,]
titanic.rf.model <- randomForest(Survived ~., data=titanic.train) ```