randomForest_tune | R Documentation |
Determine mtry for Random Forest Classifier Using K-Fold Cross Validation
randomForest_tune(
datasets = list(),
label.col = 1,
positive.class = NULL,
folds.num = 10,
ntree = 3000,
mtry.ratios = c(0.1, 0.2, 0.4, 0.6, 0.8),
seed = 1,
return.model = TRUE,
parallel.cores = 2,
...
)
datasets |
should be a list containing one or several input datasets. If input several datasets, stratified cross validation will be performed. See examples. |
label.col |
an integer. Column number of the label. |
positive.class |
|
folds.num |
an integer. Number of folds. Default |
ntree |
integer, number of trees to grow. See |
mtry.ratios |
(only when |
seed |
random seed for data splitting. Integer. |
return.model |
logical. If |
parallel.cores |
an integer specifying the number of cores for parallel computation. Default: |
... |
other parameters (except |
If return.model = TRUR
, the function returns a random forest model.
If FALSE
, the function returns the optimal ntree
and the performance.
randomForest_RFE
, randomForest_CV
, randomForest
# Following codes only show how to use this function
# and cannot reflect the genuine performance of tools or classifiers.
data(demoPositiveSeq)
data(demoNegativeSeq)
RNA.positive <- demoPositiveSeq$RNA.positive
Pro.positive <- demoPositiveSeq$Pro.positive
RNA.negative <- demoNegativeSeq$RNA.negative
Pro.negative <- demoNegativeSeq$Pro.negative
dataPositive <- featureFreq(seqRNA = RNA.positive, seqPro = Pro.positive,
label = "Interact", featureMode = "conc",
computePro = "DeNovo", k.Pro = 3, k.RNA = 2,
normalize = "none", parallel.cores = 2)
dataNegative <- featureFreq(seqRNA = RNA.negative, seqPro = Pro.negative,
label = "Non.Interact", featureMode = "conc",
computePro = "DeNovo", k.Pro = 3, k.RNA = 2,
normalize = "none", parallel.cores = 2)
dataset <- rbind(dataPositive, dataNegative)
Perf_tune <- randomForest_tune(datasets = list(dataset), label.col = 1,
positive.class = "Interact", folds.num = 5,
ntree = 150, seed = 123,
return.model = TRUE, parallel.cores = 2,
importance = TRUE)
# if you have more than one input dataset,
# use "datasets = list(dataset1, dataset2, dataset3)".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.