File: confusionMatrix.train.Rd

package info (click to toggle)
r-cran-caret 7.0-1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,036 kB
  • sloc: ansic: 210; sh: 10; makefile: 2
file content (79 lines) | stat: -rw-r--r-- 2,634 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/confusionMatrix.R
\name{confusionMatrix.train}
\alias{confusionMatrix.train}
\alias{confusionMatrix.rfe}
\alias{confusionMatrix.sbf}
\title{Estimate a Resampled Confusion Matrix}
\usage{
\method{confusionMatrix}{train}(
  data,
  norm = "overall",
  dnn = c("Prediction", "Reference"),
  ...
)
}
\arguments{
\item{data}{An object of class \code{\link{train}}, \code{\link{rfe}},
\code{\link{sbf}} that did not use out-of-bag resampling or leave-one-out
cross-validation.}

\item{norm}{A character string indicating how the table entries should be
normalized. Valid values are "none", "overall" or "average".}

\item{dnn}{A character vector of dimnames for the table}

\item{\dots}{not used here}
}
\value{
a list of class \code{confusionMatrix.train},
\code{confusionMatrix.rfe} or \code{confusionMatrix.sbf} with elements
\item{table}{the normalized matrix} \item{norm}{an echo fo the call}
\item{text}{a character string with details about the resampling procedure
(e.g. "Bootstrapped (25 reps) Confusion Matrix"}
}
\description{
Using a \code{\link{train}}, \code{\link{rfe}}, \code{\link{sbf}} object,
determine a confusion matrix based on the resampling procedure
}
\details{
When \code{\link{train}} is used for tuning a model, it tracks the confusion
matrix cell entries for the hold-out samples. These can be aggregated and
used for diagnostic purposes. For \code{\link{train}}, the matrix is
estimated for the final model tuning parameters determined by
\code{\link{train}}. For \code{\link{rfe}}, the matrix is associated with
the optimal number of variables.

There are several ways to show the table entries. Using \code{norm = "none"}
will show the aggregated counts of samples on each of the cells (across all
resamples). For \code{norm = "average"}, the average number of cell counts
across resamples is computed (this can help evaluate how many holdout
samples there were on average). The default is \code{norm = "overall"},
which is equivalento to \code{"average"} but in percentages.
}
\examples{


data(iris)
TrainData <- iris[,1:4]
TrainClasses <- iris[,5]

knnFit <- train(TrainData, TrainClasses,
                method = "knn",
                preProcess = c("center", "scale"),
                tuneLength = 10,
                trControl = trainControl(method = "cv"))
confusionMatrix(knnFit)
confusionMatrix(knnFit, "average")
confusionMatrix(knnFit, "none")


}
\seealso{
\code{\link{confusionMatrix}}, \code{\link{train}},
\code{\link{rfe}}, \code{\link{sbf}}, \code{\link{trainControl}}
}
\author{
Max Kuhn
}
\keyword{utilities}