Description Usage Arguments Details Value Note Author(s) References See Also Examples
Chooses a the best projection from a set of size B2 based on a test error estimate, then classifies the training and test sets using the chosen projection.
1 2 |
XTrain |
An |
YTrain |
A vector of length |
XTest |
An |
d |
The lower dimension of the image space of the projections |
B2 |
The block size |
base |
The base classifier one of |
k |
The options for |
projmethod |
Either |
estmethod |
Method for estimating the test errors to choose the projection: either training error |
... |
Optional further arguments if |
Randomly projects the the data B2 times. Chooses the projection yielding the smallest estimate of the test error. Classifies the training set (via the same method as estmethod) and test set using the chosen projection.
Returns a vector of length n + n.test: the first n entries are the estimated classes of the training set, the last n.test are the estimated classes of the test set.
Resubstitution method unsuitable for the k-nearest neighbour classifier.
Timothy I. Cannings and Richard J. Samworth
Cannings, T. I. and Samworth, R. J. (2017) Random-projection ensemble classification, J. Roy. Statist. Soc., Ser. B. (with discussion), 79, 959–1035
RPParallel, RPChooseSS, lda, qda, knn
1 2 3 4 5 6 7 8 9 10 11 | set.seed(100)
Train <- RPModel(1, 50, 100, 0.5)
Test <- RPModel(1, 100, 100, 0.5)
Choose.out5 <- RPChoose(XTrain = Train$x, YTrain = Train$y, XTest = Test$x,
d = 2, B2 = 5, base = "QDA", projmethod = "Haar", estmethod = "loo")
Choose.out10 <- RPChoose(XTrain = Train$x, YTrain = Train$y, XTest = Test$x,
d = 2, B2 = 10, base = "QDA", projmethod = "Haar", estmethod = "loo")
sum(Choose.out5[1:50] != Train$y)
sum(Choose.out10[1:50] != Train$y)
sum(Choose.out5[51:150] != Test$y)
sum(Choose.out10[51:150] != Test$y)
|
Loading required package: distr
Loading required package: startupmsg
:startupmsg> Utilities for Start-Up Messages (version 0.9.5)
:startupmsg>
:startupmsg> For more information see ?"startupmsg",
:startupmsg> NEWS("startupmsg")
Loading required package: sfsmisc
:distr> Object Oriented Implementation of Distributions (version
:distr> 2.7.0)
:distr>
:distr> Attention: Arithmetics on distribution objects are
:distr> understood as operations on corresponding random variables
:distr> (r.v.s); see distrARITH().
:distr>
:distr> Some functions from package 'stats' are intentionally masked
:distr> ---see distrMASK().
:distr>
:distr> Note that global options are controlled by distroptions()
:distr> ---c.f. ?"distroptions".
:distr>
:distr> For more information see ?"distr", NEWS("distr"), as well as
:distr> http://distr.r-forge.r-project.org/
:distr> Package "distrDoc" provides a vignette to this package as
:distr> well as to several extension packages; try
:distr> vignette("distr").
Attaching package: 'distr'
The following objects are masked from 'package:stats':
df, qqplot, sd
Loading required package: MASS
Loading required package: parallel
[1] 19
[1] 19
[1] 52
[1] 53
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.