Creates a single decision tree based on an input matrix and class vector. This is the function used by rerf to generate trees.
BuildTree(X, Y, FUN, paramList, min.parent, max.depth, bagging,
replacement, stratify, class.ind, class.ct, store.oob, store.impurity,
progress, rotate)
an n by d numeric matrix (preferable) or data frame. The rows correspond to observations and columns correspond to features.
an n length vector of class labels. Class labels must be integer or numeric and be within the range 1 to the number of classes.
a function that creates the random projection matrix.
parameters in a named list to be used by FUN. If left unchanged,
default values will be populated, see defaults
for details.
the minimum splittable node size. A node size < min.parent will be a leaf node. (min.parent = 6)
the longest allowable distance from the root of a tree to a leaf node (i.e. the maximum allowed height for a tree). If max.depth=0, the tree will be allowed to grow without bound.
a non-zero value means a random sample of X will be used during tree creation. If replacement = FALSE the bagging value determines the percentage of samples to leave out-of-bag. If replacement = TRUE the non-zero bagging value is ignored.
if TRUE then n samples are chosen, with replacement, from X.
if TRUE then class sample proportions are maintained during the random sampling. Ignored if replacement = FALSE.
a vector of lists. Each list holds the indexes of its respective class (e.g. list 1 contains the index of each class 1 sample).
a cumulative sum of class counts.
if TRUE then the samples omitted during the creation of a tree are stored as part of the tree. This is required to run OOBPredict().
if TRUE then the reduction in Gini impurity is stored for every split. This is required to run FeatureImportance().
if true a pipe is printed after each tree is created. This is useful for large datasets.
if TRUE then the data matrix X is uniformly randomly rotated.
Tree
# NOT RUN {
x <- iris[, -5]
y <- as.numeric(iris[, 5])
# BuildTree(x, y, RandMatBinary, p = 4, d = 4, rho = 0.25, prob = 0.5)
# }
Run the code above in your browser using DataLab