Reputation: 491
I have a relatively simple question:
What is a fully grown tree in R package Randomforest. I assume it is an unpruned tree, but apparently it does not need to include all variables as this example shows :
Is it correct to state that a fully grown tree, is a tree in which each leaf only contains samples of one class ?
data(mtcars)
dataset <- mtcars
dataset$cyl <- factor(paste0("VV",dataset$cyl))
control <- trainControl(method="repeatedcv",number=10,repeats=10,savePredictions="final",classProbs=TRUE,sampling="up")
fit <- train(cyl~.,data=dataset,method="rf",metric="Accuracy",tuneLength = 4,trControl=control,na.action=na.omit)
tree <- randomForest::getTree(fit$finalModel,k = 1,labelVar = TRUE)
tree
Upvotes: 1
Views: 239
Reputation: 10375
Yes, a fully grown tree is a tree with no constrains about size / depth (well, depth less than 32 in RandomForest, but that's not important). This means that the tree will grow until there remains only 1 observation per node / leaf. And yes, you will not necessarily use all variables in such a tree, since these are chosen at random.
Upvotes: 2