Peter Pisher
Peter Pisher

Reputation: 491

Random Forrest Fully Grown Tree

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

Answers (1)

user2974951
user2974951

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

Related Questions