Description Usage Arguments Value Methods References See Also Examples
Compute variable importance based on out-of-bag estimates. For each tree in the forest, the predictions of the out-of-bag examples are recorded. Then, a variable v is randomly permuted in the out-of-bag examples, and the tree is used to classify the out-of-bag examples again. The difference in votes for the correct class in the original data and the permuted data is used to calculate the variable importance for variable v. This process is then repeated for all variables.
1 2 3 |
forest |
A random forest of class |
x |
A |
impbyexample |
A logical indicating whether to compute the variable importance for each out-of-bag example. |
reuse.cache |
|
trace |
|
A list with the following components:
importance
:Importance of each variable, which is the number of votes for the correct class in the out-of-bag examples with variable v permuted subtracted from the number of votes for the correct class in the original out-of-bag examples, averaged over all trees in the forest.
importance.ex
:Importance of each variable for each out-of-bag example.
zscore
:Z-score of each variable, computed by dividing the raw variable importance score by the standard error.
significance
:Significance level of each variable importance, computed by applying the complementary error function on the z-score.
signature(forest = "bigcforest")
Compute variable importance for 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.
forest <- bigrfc(x, y, ntree=30L, varselect=vars, cachepath=NULL)
# Calculate variable importance, including those for each out-of-bag example.
importance <- varimp(forest, x, impbyexample=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.