merge-methods: Merge Two Random Forests

Description Usage Arguments Details Value Methods References Examples

Description

Merge two random forests into one. This is useful, for example, for building random forests in parallel on multiple machines, then combining them into a single forest.

Usage

1
2
## S4 method for signature 'bigcforest,bigcforest'
merge(x, y)

Arguments

x

A random forest of class "bigcforest".

y

A random forest of class "bigcforest", built using the same data sources and forest-building parameters as x.

Details

These methods copy all the trees from y into x, and calculates the error statistics and confusion matrices of the merged forest.

Value

The merged forest of the same class as the input arguments.

Methods

signature(x = "bigcforest", y = "bigcforest")

Merges the classification random forests x and y.

References

Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32.

Breiman, L. & Cutler, A. (n.d.). Random Forests. Retrieved from http://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Classify cars in the Cars93 data set by type (Compact, Large,
# Midsize, Small, Sporty, or Van).

# Load data.
data(Cars93, package="MASS")
x <- Cars93
y <- Cars93$Type

# Select variables with which to train model.
vars <- c(4:22)

# Run model, grow 15 trees.
forest <- bigrfc(x, y, ntree=15L, varselect=vars, cachepath=NULL)

# Build a second forest.
forest2 <- bigrfc(x, y, ntree=10L, varselect=vars, cachepath=NULL)

# Merge the two forests.
big.forest <- merge(forest, forest2)

aloysius-lim/bigrf documentation built on May 11, 2019, 11:20 p.m.