Learn R Programming

RPEnsemble (version 0.2)

RPEnsembleClass: Classifies the test set using the random projection ensemble classifier

Description

Performs a biased majority vote over B1 base classifications to classify the test set.

Usage

RPEnsembleClass(RP.out, n , n.val, n.test, p1, splitsample, alpha, ...)

Arguments

RP.out
The result of a call to RPParallel
n
Training set sample size
n.test
Test set sample size
n.val
Validation set sample size
p1
Prior probability estimate
splitsample
TRUE if using sample-splitting method
alpha
The voting threshold
...
Optional further arguments if base = "other"

Value

n.test containing the estimated classes of the test set (either 1 or 2).

Details

An observation in the test set is assigned to class 1 if B1*alpha or more of the base classifications are class 1 (otherwise class 2).

References

Cannings, T. I. and Samworth, R. J. (2015) Random projection ensemble classification. http://arxiv.org/abs/1504.04595

See Also

RPParallel, RPalpha, RPChoose

Examples

Run this code
Train <- RPModel(1, 50, 20, 0.5)
Test <- RPModel(1, 100, 20, 0.5)
Out <- RPParallel(XTrain = Train$x, YTrain = Train$y, XTest = Test$x, 
d = 2, B1 = 100, B2 = 10, base = "LDA", projmethod = "Haar", 
estmethod = "resub", cores = 1)
Class <- RPEnsembleClass(RP.out = Out, n = length(Train$y), 
n.test = nrow(Test$x), p1 = sum(Train$y == 1)/length(Train$y),  
splitsample = FALSE,  alpha = RPalpha(Out, Y = Train$y, 
p1 = sum(Train$y == 1)/length(Train$y)))
mean(Class != Test$y)

Run the code above in your browser using DataLab