File: margin.Rd

package info (click to toggle)
r-cran-randomforest 4.7-1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 496 kB
  • sloc: ansic: 1,897; fortran: 366; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,582 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
\name{margin}
\alias{margin}
\alias{margin.default}
\alias{margin.randomForest}
\alias{plot.margin}
\title{Margins of randomForest Classifier}
\description{
  Compute or plot the margin of predictions from a randomForest classifier.
}
\usage{
\method{margin}{randomForest}(x, ...)
\method{margin}{default}(x, observed, ...)
\method{plot}{margin}(x, sort=TRUE, ...)
}
\arguments{
  \item{x}{an object of class \code{\link{randomForest}}, whose
    \code{type} is not \code{regression}, or a matrix of predicted
	probabilities, one column per class and one row per observation.
	For the \code{plot} method, \code{x} should be an object returned by
	\code{margin}.}
  \item{observed}{the true response corresponding to the data in \code{x}.}
  \item{sort}{Should the data be sorted by their class labels?}
  \item{...}{other graphical parameters to be passed to \code{plot.default}.}
}
\value{
  For \code{margin}, the \emph{margin} of observations from the
  \code{\link{randomForest}} classifier (or whatever classifier that
  produced the predicted probability matrix given to \code{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.
}
\seealso{
  \code{\link{randomForest}}
}
\examples{
set.seed(1)
data(iris)
iris.rf <- randomForest(Species ~ ., iris, keep.forest=FALSE)
plot(margin(iris.rf))
}
\author{Robert Gentlemen, with slight modifications by Andy Liaw}
\keyword{classif}