# NOT RUN {
suppressWarnings(RNGversion("3.5.0"))
set.seed(23)
labels = sample(c("female", "male", "unknown", "noname"), 100, replace = TRUE)
predictions = sample(c("female", "male", NA), 100, replace = TRUE)
classificationErrors(labels, predictions)
# $confMatrix
# predictions
# labels female male <NA>
# female 6 6 8
# male 6 10 10
# noname 12 6 17
# unknown 5 7 7
# <NA> 0 0 0
#
# $errorTotal
# [1] 0.67
#
# $errorFullFirstNames
# [1] 0.6461538
#
# $errorCoded
# [1] 0.6521739
#
# $errorCodedWithoutNA
# [1] 0.4285714
#
# $naTotal
# [1] 0.42
#
# $naFullFirstNames
# [1] 0.3846154
#
# $naCoded
# [1] 0.3913043
#
# $errorGenderBias
# [1] 0
# }
Run the code above in your browser using DataLab