This function computes the misclassification error.
Usage
classification_error_rate(
true,
pred,
weights = NULL,
multi = c("average", "raw"),
...
)
Arguments
- true
a vector of observed values
- pred
a vector of predicted values
- weights
vector of observation weights
- multi
what to do when response has multiple classes
average
errors of multiple classes are averaged to get a single value
raw
returns a vector containing one score for each class
- ...
not currently used
Value
A numeric vector of length one if multi = "average"
or nc
if
multi = "raw"
, where nc
is the number of classes.
Details
The classification error rate measures the fraction of all instances that are wrongly categorized. It is defined as:
$$ERR = \frac{errors}{total} = \frac{FP + FN}{P + N} = \frac{FP + FN}{TP + FP + TN + FN} = 1 - ACC$$
The optimal value is 0 and the worst value is 1. The complementary statistic is the accuracy
.