learn {ofw} | R Documentation |
learn
simply performs the learning step of ofw
on several bootstrap samples in order to assess the error rate on the test observations (see evaluate
)
## Default S3 method: learn(x, y, type="CART", ntree= if(type=="CART") 50 else NULL, nforest= if(type=="CART") 100 else NULL, nsvm= if(type=="SVM") 20000 else NULL, mtry=5, do.trace=FALSE, nstable=50, weight=FALSE, Bsample=5, ...)
x |
A data frame with continuous values. |
y |
A response vector given as a factor (classification only). |
type |
Classifier used: either CART or SVM . |
ntree |
If CART , number of trees to grow for each iteration (trees aggregation). |
nforest |
If CART , number of iterations to run. This should not be set to too small a number, to ensure the convergence of the algorithm. |
nsvm |
If SVM , number of iterations to run. This should be set to a very large number, to ensure the convergence of the algorithm. |
mtry |
Number of variables sampled according to the weight vector P as candidates for each tree or SVM. This should be small enough to ensure stable results of the algorithm. |
do.trace |
If set to some integer, then current iteration is printed for every do.trace iterations and the number of the first stable variables is output. |
nstable |
Need do.trace set to some integer. Stopping criterion before nforest iterations are reached: if the nstable first weighted variables are the same after do.stable iterations, then stop. |
weight |
Should the weighting procedure be applied ? |
Bsample |
Number of bootstrap samples for the learning step. |
... |
not used currently. |
The object from class learn
will be used in the generic function evaluate
An object of class learn
, which is a list with the
following components:
x |
Original input |
y |
Original predictor |
type |
Classifier used: either CART or SVM |
nsample |
Total number of samples |
nclass |
Number of levels of y (number of classes) |
weight |
If TRUE the weighted procedure was performed during the learning. |
Bsample |
Number of bootstrap samples on which ofwCART is learnt. |
matTrain |
A n by Bsample matrix indicating the training samples in each bootstrap sample. |
matProb |
A nvariable by Bsample matrix for each probability distribution learnt. |
classWeight |
If weight = TRUE class weight vector. |
sampleWeight |
If weight = TRUE sample weight vector. |
The computation of learn is slow as it requires to launch ofw
Bsample
times.
Parallelized computations are possible with ofw
and Rmpi
library for the learning step and evaluateCARTparallel
for the evaluation step.
Kim-Anh L^e Cao Kim-Anh.Le-Cao@toulouse.inra.fr
Patrick Chabrier Patrick.Chabrier@toulouse.inra.fr
L^e Cao, K-A., Gonc calves, O., Besse, P. and Gadat, S. (2007), Selection of biologically relevant genes with a wrapper stochastic algorithm Statistical Applications in Genetics and Molecular Biology: Vol. 6: Iss.1, Article 29. L^e Cao, K-A., Bonnet, A., and Gadat, S., Multiclass classification and gene selection with a stochastic algorithm http://www.lsp.ups-tlse.fr/Recherche/Publications/2007/cao05.html.
## On data set "data" #data(srbct) #attach(srbct) #learn.boot.cart <- learnCART(srbct, as.factor(class),type="CART", ntree=50, nforest=200, mtry=5, Bsample=3) #learn.boot.svm <- learnSVM(srbct, as.factor(class), type="SVM", nsvm=500, mtry=5, Bsample=3) #detach(srbct)