prepareForPredictBC: Convert node predictions into probabilities for binary...

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

1
prepareForPredictBC(object,  dataT, mcls=NULL)

Arguments

object

an object of the class randomForest

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 NULL, the class name from the first record in dataT will be set as "1"

Value

an object of class randomForest with a new type="binary".

Author(s)

Anna Palczewska annawojak@gmail.com

See Also

randomForest

Examples

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)

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