Description Usage Arguments Value Author(s) See Also Examples
This method makes predictions for a binary classification Random Forest model by computing the arithmetic mean of the "probability"
generated by each tree, across all trees in the forest, that the instance being predicted will belong to the "selected" class.
For a single tree, 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. This function will only work when applied to a randomForest
object modified by
prepareForPredictBC
.
1 | predictBC(object, dataT)
|
object |
an object of class |
dataT |
a data frame containing the variables in the model for the instances for which predictions are desired |
A vector of predictions for instances from the dataT
dataset. The predicted values represent the estimated probability that the instance is in the "selected" class (the class of the the first instance in dataT
).
Anna Palczewska annawojak@gmail.com
randomForest
, prepareForPredictBC
1 2 3 4 5 6 7 8 9 10 11 12 |
## 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])
predicted<-predictBC(new_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.