Description Usage Arguments Value Author(s) See Also Examples
This method checks the unanimity of all individual trees in the forest for classification models: this denotes the condition that, for any given leaf (i.e. terminal) node of the tree, all instances in the training set assigned to that node should belong to a single class. If this holds for a single tree, the tree is considered unanimous. Only if this condition -i.e. that all trees are unanimous - holds will the predictions obtained (for "class 1") for a binary classification model using predict(...,type="prob") and predictBC(...) be the same.
1 | checkForestUnanimity(object, dataT)
|
object |
an object of the class |
dataT |
a data frame with columns containing the attributes (descriptors) for all instances (rows) in the training set of the |
A list with the following components:
dec |
|
tcCount |
a list providing the number of training set instances in each class for each terminal node in all trees. Where the number 0 is presented for all classes, the corresponding node is not a terminal node. |
tuStatus |
a vector, with one element per tree, denoting whether or not that tree was unanimous (TRUE) or not (FALSE) |
Anna Palczewska annawojak@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #Iris dataset
library(randomForest)
data(iris)
rF_Model <- randomForest(x=iris[,-5],y=as.factor(as.character(iris[,5])),
ntree=10,importance=TRUE, keep.inbag=TRUE,replace=FALSE)
#Check unanimity
itest<-checkForestUnanimity(rF_Model, iris[,-5])
## Not run:
# Ames dataset
data(ames)
ames_train<-ames[ames$Type=="Train",-c(1,3, ncol(ames))]
rF_Model <- randomForest(x=ames_train[,-1],y=as.factor(as.character(ames_train[,1])),
ntree=500,importance=TRUE, keep.inbag=TRUE,replace=FALSE)
itest<-checkForestUnanimity(rF_Model, ames_train[,-1])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.