myrandomForest | R Documentation |
randomForest: Classification and Regression with Random Forest randomForest implements Breiman's random forest algorithm (based on Breiman and Cutler's original Fortran code) for classification and regression. It can also be used in unsupervised mode for assessing proximities among data points. #'
myrandomForest( x, y = NULL, xtest = NULL, ytest = NULL, ntree = 500, mtry = if (!is.null(y) && !is.factor(y)) max(floor(ncol(x)/3), 1) else floor(sqrt(ncol(x))), replace = TRUE, classwt = NULL, cutoff, strata, sampsize = if (replace) nrow(x) else ceiling(0.632 * nrow(x)), nodesize = if (!is.null(y) && !is.factor(y)) 5 else 1, importance = FALSE, localImp = FALSE, nPerm = 1, proximity, oob.prox = proximity, norm.votes = TRUE, do.trace = FALSE, keep.forest = !is.null(y) && is.null(xtest), corr.bias = FALSE, keep.inbag = FALSE, maxLevel = 0, keep.group = FALSE, corr.threshold = 1, corr.method = "pearson", ... )
x |
formula, a data frame or a matrix of predictors, or a formula describing the model to be fitted (for the print method, an randomForest object). |
y |
A response vector. If a factor, classification is assumed, otherwise regression is assumed. If omitted, randomForest will run in unsupervised mode. |
xtest |
a data frame or matrix (like x) containing predictors for the test set. |
ytest |
response for the test set. |
ntree |
Number of trees to grow. This should not be set to too small a number, to ensure that every input row gets predicted at least a few times. |
mtry |
Number of variables randomly sampled as candidates at each split. Note that the default values are different for classification (sqrt(p) where p is number of variables in x) and regression (p/3) |
replace |
Should sampling of cases be done with or without replacement? |
classwt |
Priors of the classes. Need not add up to one. Ignored for regression. |
cutoff |
(Classification only) A vector of length equal to number of classes. The ‘winning’ class for an observation is the one with the maximum ratio of proportion of votes to cutoff. Default is 1/k where k is the number of classes (i.e., majority vote wins). |
strata |
A (factor) variable that is used for stratified sampling. |
sampsize |
Size(s) of sample to draw. For classification, if sampsize is a vector of the length the number of strata, then sampling is stratified by strata, and the elements of sampsize indicate the numbers to be drawn from the strata. |
nodesize |
Minimum size of terminal nodes. Setting this number larger causes smaller trees to be grown (and thus take less time). Note that the default values are different for classification (1) and regression (5). |
importance |
Should importance of predictors be assessed? |
localImp |
Should casewise importance measure be computed? (Setting this to TRUE will override importance.) |
nPerm |
Number of times the OOB data are permuted per tree for assessing variable importance. Number larger than 1 gives slightly more stable estimate, but not very effective. Currently only implemented for regression. |
proximity |
Should proximity measure among the rows be calculated? |
oob.prox |
Should proximity be calculated only on “out-of-bag” data? |
norm.votes |
If TRUE (default), the final result of votes are expressed as fractions. If FALSE, raw vote counts are returned (useful for combining results from different runs). Ignored for regression. |
do.trace |
If set to TRUE, give a more verbose output as randomForest is run. If set to some integer, then running output is printed for every do.trace trees. |
keep.forest |
If set to FALSE, the forest will not be retained in the output object. If xtest is given, defaults to FALSE. |
corr.bias |
perform bias correction for regression? Note: Experimental. Use at your own risk. |
keep.inbag |
Should an n by ntree matrix be returned that keeps track of which samples are “in-bag” in which trees (but not how many times, if sampling with replacement) |
maxLevel |
If maxLevel == 0, compute importance from marginal permutation distribution of each variable (the default). If maxLevel > 0, compute importance from conditional permutation distribution of each variable, permuted within 2^maxLevel partitions of correlated variables. |
keep.group |
If TRUE keep diagnostic information on the partitioning for the importance calculation. |
corr.threshold |
If maxLevel > 0, OOB permuting is conditioned on partitions of variables having absolute correlation > corr.threshold. |
corr.method |
Method for computing correlation between variables. Default "pearson". |
... |
optional parameters to be passed to the low level function randomForest.default. |
data |
an optional data frame containing the variables in the model. By default the variables are taken from the environment which randomForest is called from. |
subset |
an index vector indicating which rows should be used. (NOTE: If given, this argument must be named.) |
na.action |
A function to specify the action to be taken if NAs are found. (NOTE: If given, this argument must be named.) |
data.frame of predictor variables.
data(CoMLsimulation) preds <- colnames(Xsimulation) specs <- colnames(Ysimulation) f1 <- gradientForest(data.frame(Ysimulation,Xsimulation), preds, specs, ntree=10) f1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.