Classification Workflows
Classification Threshold
Turn Scores Into Labels
A classifier often turns probabilities into labels by comparing each score with a cutoff.
Program
Play the script to change the cutoff and see how many records are classified as yes.
classification_threshold.R
cutoff <-
prob <- c(0.20, 0.65, 0.80, 0.55)
predicted <- ifelse(prob >= cutoff, "yes", "no")
yes_count <- sum(predicted == "yes")
label <- paste("yes", yes_count, sep = ":")
cat(label, "\n", sep = "")
cutoff <-
prob <- c(0.20, 0.65, 0.80, 0.55)
predicted <- ifelse(prob >= cutoff, "yes", "no")
yes_count <- sum(predicted == "yes")
label <- paste("yes", yes_count, sep = ":")
cat(label, "\n", sep = "")
cutoff <-
prob <- c(0.20, 0.65, 0.80, 0.55)
predicted <- ifelse(prob >= cutoff, "yes", "no")
yes_count <- sum(predicted == "yes")
label <- paste("yes", yes_count, sep = ":")
cat(label, "\n", sep = "")
probability
Scores near 1 are stronger evidence for the positive class.
threshold
`prob >= cutoff` creates one decision per score.
label count
Counting labels gives a quick summary of classifier output.