predict.obliqueRF: predict method for oblique random forest objects

Description Usage Arguments Value Author(s) References See Also Examples

Description

Prediction of test data using oblique random forest.

Usage

1
2
## S3 method for class 'obliqueRF'
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.

Author(s)

Bjoern Menze <menze@csail.mit.edu> and D.N. Splitthoff <nico.splitthoff@gmx.de>.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

Example output

Loading required package: ROCR
Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:stats':

    lowess

Loading required package: pls

Attaching package: 'pls'

The following object is masked from 'package:stats':

    loadings

Loading required package: mda
Loading required package: class
Loaded mda 0.4-9

Loading required package: e1071
obliqueRF 0.3
Type orfNews() to see new features/changes/bug fixes.
obliqueRF: using fast ridge regression with SVD as node model,
 does not scale data at the node,
 tests regularization parameter "lambda" for 10^(c(-5:5)).
 In case of problems with the SVD variant try training_method="ridge_slow" for separate ridge regressions (slower).
obliqueRF: no test set defined. Will use training data.
[1] 0

obliqueRF documentation built on May 2, 2019, 4:19 a.m.