Search⌘ K
AI Features

Classifiers and Thresholds

Explore the concept of classifiers in supervised learning by understanding how models assign inputs to categories using confidence scores and decision thresholds. Learn about soft and hard predictions, the impact of threshold selection on classification accuracy, and approaches to binary and multi-class classification. This lesson equips you to choose appropriate classifiers and thresholds based on problem-specific consequences.

Today, machines play a crucial role in handling tasks that would be costly, time-consuming, or even impractical for humans to perform manually. From filtering emails to detecting fraud in financial transactions, these automated systems rely on machine learning to make accurate and efficient decisions. One of the most fundamental problems in machine learning is classification, a type of supervised learning where the goal is to assign an input to one of a predefined set of categories or classes.

In this lesson, we will explore the core concepts of classification, including how models process inputs to make predictions and how the decision threshold determines the final classification.

Classifier

Every machine takes an input, performs its respective function on that input, and produces an output. When this machine is configured/trained to predict a category/class label from a prespecified finite set of categories, it’s called a classifier.

For example, suppose we have a set of inputs, x, and the machine gives an output of either 1 or 0:

x (Input)

y (Output)

4

1

-2

0

-3

1

7

0

Here, the possible class labels are 0 and 1, and the classifier’s job is to assign the correct label to each input.

Assume we have a library of pre-trained models, represented by three potential functions: f1(x)f_1(x), f2(x)f_2(x), and f3(x)f_3(x). Our task is to determine which of these models (functions) best simulates the behavior of the desired machine.

Try any integer xx, especially, 44, 2-2, 3-3, and 77 to get the output of each function.

Python 3.10.4
# Note: Implementation of all three functions is hidden.
x = int(input())
f1_y = f1(x)
f2_y = f2(x)
f3_y = f3(x)
print(f"f1({x}) = {f1_y}, \t f2({x}) = {f2_y}, \t f3({x}) = {f3_y}.")
Did you find this helpful?

Now that you’ve tested the code above for each required entry, answer the following question:

Technical Quiz
1.

Which function is best suited for our machine?

A.

f1(x)f_1(x)

B.

f2(x)f_2(x)

C.

f3(x)f_3(x)


1 / 1

Prediction confidence

Prediction confidence is the level of certainty that a machine learning model has in its predictions, and it can be expressed through hard or soft predictions.

Hard prediction

Predicting actual class labels (0(0 or 1)1) is called hard prediction. It seems to be a desirable property of a classifier, but it’s generally ...