Description Usage Arguments Value Author(s) See Also Examples
This method can only be aplied for a binary classification model. Its primary purpose is to process a randomForest
object as required for predictBC()
.
This method converts node predictions in the randomForest
object.
The current class label in terminal nodes is replaced by the probability of belonging to a "selected" class - where the probability is calculated as the proportion of local training set instances assigned to the terminal node in question which belong to the "selected" class.
The class of the first instance in the complete training dataset is chosen as the "selected" class.
1 | prepareForPredictBC(object, dataT, mcls=NULL)
|
object |
an object of the class |
dataT |
a data frame containing the variables in the model for all instances in the training set |
mcls |
main class that be set to "1" for binary classification. If |
an object of class randomForest
with a new type="binary"
.
Anna Palczewska annawojak@gmail.com
1 2 3 4 5 6 7 8 9 | ## Not run:
library(randomForest)
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)
new_Model<-prepareForPredictBC(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.