Description Usage Arguments Details Value Methods References Examples
Predict the classes of a set of test examples using a random forest.
1 2 3 |
object |
A random forest of class |
x |
A |
y |
An integer or factor vector of response variables. Test errors will be calculated only if |
printerrfreq |
An integer, specifying how often error estimates should be printed to the screen. Default: error estimates will be printed every 10 trees. |
printclserr |
|
cachepath |
Path to folder where data caches used in building the forest can be stored. If |
trace |
|
These methods copy all the trees from y
into x
, and calculates the error statistics and confusion matrices of the merged forest.
An object of class "bigcprediction"
containing the prediction results.
signature(object = "bigcforest")
Predict classes of a set of test examples using a classification random forest.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # 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 30 trees on the first 60 examples.
forest <- bigrfc(x[1:60, ], y[1:60], ntree=30L, varselect=vars, cachepath=NULL)
# Get predictions for the remaining examples.
predictions <- predict(forest, x[-(1:60), ], y[-(1:60)], cachepath=NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.