MiNTreesAjust {MiDA} | R Documentation |
Ajust number of trees parameter for fitting generalized boosted regression models
Description
Test total number of trees parameter for microarray data binary classification using gradient boosting over desicion trees.
Usage
MiNTreesAjust(Matrix, specimens, test.frac = 5, times = 5,
ntrees = c(100, 500, 1000, 5000, 10000), shrinkage = 0.1,
intdepth = 2, n.terminal = 10, bag.frac = 0.5)
Arguments
Matrix |
numeric matrix of expression data where each row corresponds to a probe (gene, transcript), and each column correspondes to a specimen (patient). |
specimens |
factor vector with two levels specifying specimens in the columns of the |
test.frac |
integer specifying fraction of data to use for model testing |
times |
integer specifying number of trials |
ntrees |
vector of integer specifying the total number of decision trees (boosting iterations).The tested parameter. |
shrinkage |
numeric specifying the learning rate. Scales the step size in the gradient descent procedure. |
intdepth |
integer specifying the maximum depth of each tree. |
n.terminal |
integer specifying the actual minimum number of observations in the terminal nodes of the trees. |
bag.frac |
the fraction of the training set observations randomly selected to propose the next tree in the expansion. |
Details
test.frac
defines fraction of specimens that will be used for model testing. For example, if
test.frac
=5 then 4/5th of specimens will be used for model fitting (train data) and 1/5th of specimens
will be used for model testing (test data). Specimens for test and train data will be selected by random.
So with times
>1, train and test data will differ each time.
While boosting basis functions are iteratively adding in a greedy fashion
so that each additional basis function further reduces the selected loss function.
Gaussian distribution (squared error) is used.
ntrees
, shrinkage
, intdeep
are parameters for model tuning.
bag.frac
introduces randomnesses into the model fit.
If bag.frac
< 1 then running the same model twice will result in similar but different fits.
Number of specimens in train sample must be enough to provide the minimum number of observations in terminal nodes.I.e.
(1-1/test.frac
)*bag.frac
> n.terminal
.
See gbm
for details.
Use MiIntDepthAjust
and MiShrinkAjust
for ajusting other parameters.
Function is rather time-costing. If specimens are not equally distributed between two classified groups,
NA may be produced.
Value
list of 2
train.accuracy
- a data frame of train data classification accuracy
for each ntrees
value in each trial and their median.
test.accuracy
- a data frame of test data classification accuracy
for each ntrees
value in each trial and their median.
Also a plot for ntrees
versus Accuracy is produced.
Author(s)
Elena N. Filatova
See Also
gbm
, MiIntDepthAjust
, MiShrinkAjust
Examples
#get gene expression and specimen data
data("IMexpression");data("IMspecimen")
#sample expression matrix and specimen data for binary classification,
#only "NORM" and "EBV" specimens are left
SampleMatrix<-MiDataSample(IMexpression, IMspecimen$diagnosis,"norm", "ebv")
SampleSpecimen<-MiSpecimenSample(IMspecimen$diagnosis, "norm", "ebv")
#Fitting, low tuning for faster running. Test ntrees
set.seed(1)
ClassRes<-MiNTreesAjust(SampleMatrix, SampleSpecimen, test.frac = 5, times = 3,
ntrees = c(10, 20), shrinkage = 1, intdepth = 2)
ClassRes[[1]] # train accuracy
ClassRes[[2]] # test accuracy