Learn R Programming

mclust (version 2.1-14)

classError: Classification error.

Description

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.

See Also

compareClass, mapClass, table

Examples

Run this code
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)

Run the code above in your browser using DataLab