randomForest_CV: Evaluation of Random Forest Classifier with K-Fold Cross...

View source: R/Modelling.R

randomForest_CVR Documentation

Evaluation of Random Forest Classifier with K-Fold Cross Validation

Description

Evaluation of Random Forest Classifier with K-Fold Cross Validation

Usage

randomForest_CV(
  datasets = list(),
  label.col = 1,
  positive.class = NULL,
  folds.num = 10,
  ntree = 1500,
  seed = 1,
  parallel.cores = 2,
  ...
)

Arguments

datasets

a list containing one or several input datasets. See examples.

label.col

an integer. Column number of the label.

positive.class

NULL or string. Which class is the positive class? Should be one of the classes in label column. The first class in label column will be selected as the positive class if leave positive.class = NULL.

folds.num

an integer. Number of folds. Default 10 for 10-fold cross validation.

ntree

parameter for random forest. Default: 1500. See randomForest.

seed

random seed for data splitting. Integer.

parallel.cores

an integer specifying the number of cores for parallel computation. Default: 2. Set parallel.cores = -1 to run with all the cores. parallel.cores should be == -1 or >= 1.

...

other parameters passed to randomForest function.

Value

This function return the performance of k-fold CV.

See Also

randomForest_RFE, randomForest_tune, randomForest

Examples


# Following codes only show how to use this function
# and cannot reflect the genuine performance of tools or classifiers.

data(demoPositiveSeq)
data(demoNegativeSeq)

dataPositive <- featureFreq(seqRNA = demoPositiveSeq$RNA.positive,
                            seqPro = demoPositiveSeq$Pro.positive,
                            label = "Interact", featureMode = "conc",
                            computePro = "DeNovo", k.Pro = 3, k.RNA = 2,
                            normalize = "none", parallel.cores = 2)

dataNegative <- featureFreq(seqRNA = demoNegativeSeq$RNA.negative,
                            seqPro = demoNegativeSeq$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_CV <- randomForest_CV(datasets = list(dataset), label.col = 1, ntree = 100,
                           parallel.cores = 2, mtry = 20)

# if you have more than one input dataset,
# use "datasets = list(dataset1, dataset2, dataset3)".


HAN-Siyu/ncProR documentation built on Nov. 3, 2023, 12:08 a.m.