Error for a given classification relative to a known truth.
Location of errors in a given classification relative to a known truth.
Usage
classError(classification, truth)
Arguments
classification
A numeric or character vector of class labels.
truth
A numeric or character vector of class labels.
Must have the same length as
classification.
Value
classError gives the fraction of elements
misclassified for classification
relative to truth.
classErrors is a logical vector of the
same length as classification and
truth which gives the location
of misclassified elements in classification
relative to truth.
Details
classErrors will only return one possibility
if more than one mapping between classification and truth results in the
minimum error.
a <- rep(1:3, 3)
a
b <- rep(c("A", "B", "C"), 3)
b
classError(a, b)
classErrors(a, b)
a <- sample(1:3, 9, replace = TRUE)
a
b <- sample(c("A", "B", "C"), 9, replace = TRUE)
b
classError(a, b)