Learn R Programming

RPEnsemble (version 0.5)

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

Description

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

Usage

RPEnsembleClass(RP.out, n , n.val, n.test, p1, samplesplit, 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

samplesplit

TRUE if using sample-splitting method

alpha

The voting threshold

Optional further arguments if base = "other"

Value

A vector of length n.test containing the class predictions 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. (2017) Random-projection ensemble classification, J. Roy. Statist. Soc., Ser. B. (with discussion), 79, 959--1035

See Also

RPParallel, RPalpha, RPChoose

Examples

Run this code
# NOT RUN {
Train <- RPModel(1, 50, 100, 0.5)
Test <- RPModel(1, 100, 100, 0.5)
Out <- RPParallel(XTrain = Train$x, YTrain = Train$y, XTest = Test$x, 
d = 2, B1 = 50, B2 = 10, base = "LDA", projmethod = "Haar", 
estmethod = "training", clustertype = "Default")
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