Multi-class Classifier

Revise binary classifiers and build the multi-class classifiers.

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:

Get hands-on with 1200+ tech skills courses.