Learn R Programming

RPEnsemble (version 0.1)

RPParallel: Chooses a projection from each block in parallel

Description

Makes B1 calls to RPChoose or RPChooseSS in parallel and returns the results as a matrix.

Usage

RPParallel(XTrain, YTrain, XVal, YVal, XTest, d, B1 = 100, B2 = 100, 
base = "LDA", projmethod = "Haar", estmethod = "resub", k = c(3, 5), 
cores = 2, splitsample = FALSE,  ...)

Arguments

XTrain
An n by p matrix containing the training data feature vectors
YTrain
A vector of length n containing the classes (either 1 or 2) of the training data
XVal
An n.val by p matrix containing the validation data feature vectors
YVal
A vector of length n.val of the classes (either 1 or 2) of the validation data
XTest
An n.test by p matrix containing the test data feature vectors
d
The lower dimension of the image space of the projections
B1
The number of blocks
B2
The size of each block
base
The base classifier one of "knn","LDA","QDA" or "other"
k
The options for k if base is "knn"
projmethod
Either "Haar" or "axis"
estmethod
Method for estimating the test errors to choose the projection: either resubstitution "resub" or leave-one-out "loo"
cores
The number of computer cores to use
splitsample
If TRUE will use the validation set (XVal, YVal) to estimate the test error in RPChooseSS. If FALSE will use estmethed to estimate the test error in
...
Optional further arguments if base = "other"

Value

  • If splitsample = FALSE, then returns an n+n.test by B1 matrix, each row containing the result of a call to RPChoose. If splitsample = TRUE, then returns an n.val+n.test by B1 matrix, each row containing the result of a call to RPChooseSS.

Details

Makes B1 calls to RPChoose or RPChooseSS in parallel.

References

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

See Also

RPChoose, RPChooseSS

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 = 2)
colMeans(Out)

Run the code above in your browser using DataLab