randomForest {CornerstoneR} | R Documentation |
Random Forest
Description
Random Forest via ranger
. Predicts response variables or brushed set of
rows from predictor variables, using Random Forest classification or regression.
Usage
randomForest(
dataset = cs.in.dataset(),
preds = cs.in.predictors(),
resps = cs.in.responses(),
brush = cs.in.brushed(),
scriptvars = cs.in.scriptvars(),
return.results = FALSE,
...
)
Arguments
dataset |
[ |
preds |
[ |
resps |
[ |
brush |
[ |
scriptvars |
[ |
return.results |
[ |
... |
[ANY] |
Details
The following script variables are summarized in scriptvars
list:
- brush.pred
[
logical(1)
]
Usebrush
vector as additional predictor.
Default isFALSE
.- use.rows
[
character(1)
]
Rows to use in model fit. Possible values areall
,non-brushed
, orbrushed
.
Default isall
.- num.trees
[
integer(1)
]
Number of trees to fit inranger
.
Default is500
.- importance.mode
[
character(1)
]
Variable importance mode. For details seeranger
.
Default ispermutation
.- respect.unordered.factors
[
character(1)
]
Handling of unordered factor covariates. For details seeranger
.
Default isNULL
.
Value
Logical [TRUE
] invisibly and outputs to Cornerstone or,
if return.results = TRUE
, list
of
resulting data.frame
objects:
statistics |
General statistics about the random forest. |
importances |
Variable importance of prediction variables in descending order of importance (most important first) |
predictions |
Dataset to brush with predicted values for |
confusion |
For categorical response variables or brush state only. A table with counts of each distinct combination of predicted and actual values. |
rgobjects |
List of |
See Also
Examples
# Fit random forest to iris data:
res = randomForest(iris, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"), "Species"
, scriptvars = list(brush.pred = FALSE, use.rows = "all", num.trees = 500
, importance.mode = "permutation"
, respect.unordered.factors = "ignore"
)
, brush = rep(FALSE, nrow(iris)), return.results = TRUE
)
# Show general statistics:
res$statistics
# Prediction
randomForestPredict(iris[, 1:4], c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")
, robject = res$rgobjects
, return.results = TRUE
)