obliqueRF (version 0.3)

predict.obliqueRF: predict method for oblique random forest objects

Description

Prediction of test data using oblique random forest.

Usage

"predict"(object, newdata, type="response", proximity=F,...)

Arguments

object
an object of class obliqueRF, as that created by the function obliqueRF.
newdata
a matrix containing new data.
type
one of response, prob. or votes, indicating the type of output: predicted values, matrix of class probabilities, or matrix of vote counts.
proximity
should proximity measures be computed (based on all data)?
...
not used currently.

Value

pred, which can be the following, depending on type:
response
pred is a vector with predicted classes (threshold is 0.5).
prob
pred is a matrix of class probabilities (one row for each class and one column for each input).
votes
pred 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