margin
From randomForest v4.612
by Andy Liaw
Margins of randomForest Classifier
Compute or plot the margin of predictions from a randomForest classifier.
 Keywords
 classif
Usage
"margin"(x, ...)
"margin"(x, observed, ...)
"plot"(x, sort=TRUE, ...)
Arguments
 x
 an object of class
randomForest
, whosetype
is notregression
, or a matrix of predicted probabilities, one column per class and one row per observation. For theplot
method,x
should be an object returned bymargin
.  observed
 the true response corresponding to the data in
x
.  sort
 Should the data be sorted by their class labels?
 ...
 other graphical parameters to be passed to
plot.default
.
Value

For
margin
, the margin of observations from the
randomForest
classifier (or whatever classifier that
produced the predicted probability matrix given to margin
).
The margin of a data point is defined as the proportion of votes for
the correct class minus maximum proportion of votes for the other
classes. Thus under majority votes, positive margin means correct
classification, and vice versa.
See Also
Examples
library(randomForest)
set.seed(1)
data(iris)
iris.rf < randomForest(Species ~ ., iris, keep.forest=FALSE)
plot(margin(iris.rf))
Community examples
Looks like there are no examples yet.