RPParallel {RPEnsemble}R Documentation

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 = 500, B2 = 50, 
base = "LDA",projmethod = "Gaussian", estmethod = "training", k = c(3,5,9), 
clustertype = "Default", cores = 1, machines = NULL, seed = 1, ... )

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

"Haar", "Gaussian" or "axis"

estmethod

Method for estimating the test errors to choose the projection: either training error "training", leave-one-out "loo", or sample split "samplesplit"

clustertype

The type of cluster: "Default" uses just one core, "Fork" uses a single machine, "Socket" uses many machines. Note "Fork" and "Socket" are not supported on windows.

cores

Required only if clustertype==Fork: the number of computer cores to use (note: cores > 1 not supported on Windows)

machines

Required only if clustertype==Socket: the names of the machines to use e.g. c("Computer1", "Computer2") (not supported on Windows)

seed

If not NULL, sets random seed for reproducible results

...

Optional further arguments if base = "other"

Details

Makes B1 calls to RPChoose or RPChooseSS in parallel.

Value

If estmethod == "training" or "loo" , then returns an n+n.test by B1 matrix, each row containing the result of a call to RPChoose. If estmethod == "samplesplit", then returns an n.val+n.test by B1 matrix, each row containing the result of a call to RPChooseSS.

Author(s)

Timothy I. Cannings and Richard J. Samworth

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

RPChoose, RPChooseSS

Examples

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 = 10, 
B2 = 10, base = "LDA", projmethod = "Haar", estmethod = "training")
colMeans(Out)

[Package RPEnsemble version 0.5 Index]