Multi-class Classifier
Explore the concept of multi-class classification by building a system that recognizes digits from 0 to 9 using multiple binary classifiers. Understand how weighted sums and sigmoids combine to output confidence scores and learn to select the most confident prediction for accurate digit recognition.
We'll cover the following...
In the previous chapter we achieved our goal of building a computer vision system but it is only a basic one. The program we built is a binary classifier, as it assigns data to one of two classes: “5” and “not 5.” Now, we’ll push that program further and recognize any digit in MNIST.
Instead of binary classification, the problem of recognizing digits involves many classes, so it’s called a multi-class classification problem. Do not fret about multi-class classification, because it is well within our grasp. Here’s a simple recipe for multiclass classification:
- Build a binary classifier for each class
- Combine the classifiers from each class into one multi-class classifier
Let’s turn that idea into code. We are very close to our goal of building a full-fledged MNIST classifier.
Build a multiclass classifier
Let’s recap where we are and where we want to go. We have a binary classifier that’s hardwired to recognize a specific digit, such as 5. It passes images through a weighted sum, and then a sigmoid. The result is a number ranging from 0 to 1. Then we round that number to either 1 or 0, because we want a binary result to check if it is a “5” or not, as illustrated in the following picture:
We want a program that takes an image and tells us which digit that image represents, from 0 to 9:
First, focus on that box right at the center of the first picture. It represents a weighted sum, followed by a sigmoid. There is no common name for this sequence. For short, let’s call weighted sum plus sigmoid as WSS. A WSS is like a binary classifier, except that instead of returning either or ...