Learn R Programming

obliqueRF (version 0.2)

predict.obliqueRF: predict method for oblique random forest objects

Description

Prediction of test data using oblique random forest.

Usage

## S3 method for class 'obliqueRF':
predict(object, newdata, type="response", proximity=F,...)

Arguments

Value

pred, which can be the following, depending on type:responsepred is a vector with predicted classes (threshold is 0.5).probpred is a matrix of class probabilities (one row for each class and one column for each input).votespred is a matrix of vote counts (one row for each class and one column for each new input).If proximity=TRUE, the returned object is a list with two components: pred is the prediction (as described above) and proximity is the proximitry matrix.

References

Menze BH, Kelm BM, Splitthoff DN, Koethe U, Hamprecht F. On oblique random forests. Proc ECML/PKDD 2011. LNAI, 16p. http://people.csail.mit.edu/menze/papers/menze_11_oblique.pdf.

See Also

obliqueRF

Examples

Run this code
## Classification:
require(obliqueRF);
data(iris);
#sample some cases
s<-sample(150,100);
#extract feature matrix
x_train<-as.matrix(iris[s,1:4]);
#convert to 0/1 class labels
y_train<-(as.numeric(iris[s,5])>1)*1;
iris.orf <- obliqueRF(x_train,y_train);

#extract feature matrix
x<-as.matrix(iris[-s,1:4]);
#convert to 0/1 class labels
y<-(as.numeric(iris[-s,5])>1)*1;
pred <- predict(iris.orf,x,type="response",proximity=TRUE);
sum(pred$pred!=y)

Run the code above in your browser using DataLab