randomForest
implements Breiman's random forest algorithm (based on
Breiman and Cutler's original Fortran code) for classification. It
can also be used in unsupervised mode for locating outliers or
assessing proximities among data points.## S3 method for class 'formula':
randomForest(formula, data=NULL, subset, ...)
## S3 method for class 'default':
randomForest(x, y=NULL, addclass=0, ntree=100,
mtry=ceiling(sqrt(ncol(x))), classwt=NULL, nodesize=1, importance=FALSE,
proximity=FALSE, outscale=FALSE, norm.votes=TRUE, do.trace=FALSE, ...)
## S3 method for class 'randomForest':
print(x, ...)
randomForest
is called from.print
method, an randomForest
object).randomForest
will run in unsupervised mode with addclass=1
(unless
explicitly set otherwise).=0
(default) do not add a synthetic class to
the data. =1
label the input data as class 1 and add a
synthetic class by randomly sampling from the product of empirical
marginal distributions of the input. =2
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).TRUE
, give a more verbose output as
randomForest
is run.randomForest.default
.randomForest
, which is a list with the
following components:randomForest
TRUE
if input data have class labels,
FALSE
otherwise.NULL
if
importance=FALSE
when randomForest
is called, this
component is set to NULL
).proximity=TRUE
when randomForest
is
called, a matrix of proximity measures among the input (based on the
frequency that pairs of data points are in the same terminal
nodes).outscale=TRUE
when randomForest
is
called, a vector indicating how outlying the data points are (based
on the proximity measures).NULL
if
randomForest
is run in unsupervised mode.predict.randomForest
data(iris)
iris.rf <- randomForest(Species ~ ., data=iris)
print(iris.rf)
Run the code above in your browser using DataLab