rf.cv: The Cross-Validation of Classification and Regression models...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/1101-randomForest.R

Description

The Cross-Validation of Classification and Regression models using Random Forest

Usage

1
2
rf.cv(xtr, ytr, cv.fold = 5, type = "regression", trees = 500,
  mtrysize = 10)

Arguments

xtr

A data frame or a matrix of predictors.

ytr

A response vector. If a factor, classification is assumed, otherwise regression is assumed.

cv.fold

The fold, the defalut is 5.

type

method type.

trees

Number of trees to grow. This should not be set to too small a number, to ensure that every input row gets predicted at least a few times.

mtrysize

Number of variables randomly sampled as candidates at each split. Note that the default values are different for classification (sqrt(p) where p is number of variables in xtr) and regression (p/3)

Details

rf.cv implements Breiman's random forest algorithm for classification and regression. here we use it to make a k-fold cross-validation

Value

if type is regression, the retrun a list containing four components:

if type is classification, the retrun a list containing four components:

Author(s)

Min-feng Zhu <wind2zhu@163.com>

References

Breiman, L. (2001), Random Forests, Machine Learning 45(1), 5-32.

See Also

See pls.cv for the Cross-Validation of Classification and Regression models using PLS

Examples

1
2
3
4
training = read.csv(system.file('sysdata/training2.csv', package = 'BioMedR'), header = TRUE)
y = training[, 1]
x = training[, -1]
rf.tr <- rf.cv(x, y)

Example output

OpenJDK 64-Bit Server VM warning: Can't detect primordial thread stack location - find_vma failed
.....

BioMedR documentation built on Nov. 17, 2017, 10:08 a.m.