predictBC: Makes predictions for a binary classification Random Forest...

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

1
predictBC(object, dataT)

Arguments

object

an object of class randomForest

dataT

a data frame containing the variables in the model for the instances for which predictions are desired

Value

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).

Author(s)

Anna Palczewska annawojak@gmail.com

See Also

randomForest, prepareForPredictBC

Examples

 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)

rfFC documentation built on May 2, 2019, 5:18 p.m.

Related to predictBC in rfFC...