I have trained model for classification task in R using randomForest - "RF_Model"
RF_Model <- randomForest(measure ~., data = dat), mtry=3, importance=TRUE,ntree=500)
print(RF_Model)
returns:
Call: randomForest(formula = measure ~ ., data = dat) Type of random forest: classification Number of trees: 500 No. of variables tried at each split: 3
Each object, which uses in that model, has 15 attributes. In my understanding (the basic knowledge I have got from here): mtry = number of random variables used in each tree. So, I thought, that for each sample decision tree (from those 500 trees in the forest) will be used only 3 different attributes from 15.
But when I tried to check that - I found that all the 15 attributes are used for each tree in the forest:
k <- 209 #tried here distinct values from 1 to 500
tree <- getTree(RF_Model, k, labelVar = TRUE)
and as the result, tree returns the tree with 19-27 levels of depth, and always all the 15 attributes are used for the tree.
What I am doing wrong or misunderstood? Why for the small trees in the forest (No. of variables tried at each split: 3) have been used not 3 distinct attributes, but always all 15?