Decode the Classifier’s Answers
Understand why we need more weights and dimensions.
We'll cover the following...
Overview of classifier
Let’s review how classify()
works. During the classification phase, the WSSs return arrays of ten numbers from to . But when we ask the system to recognize an image, we do not want to see those arrays, we want a human-readable answer such as “.” This means that we must decode the WSSs’ answers before returning them.
So far, the classify()
function didn’t have much to do, apart from calling forward()
and rounding its output. Now classify()
has a more complex job. It must convert the output of the WSSs back to human-readable labels, like this:
Press + to interact
def classify(X, w):y_hat = forward(X, w)labels = np.argmax(y_hat, axis=1)return labels.reshape(-1, 1)
The first line of classify()
calculates a matrix of predictions , with one row per label, and one column per class. Each row in ...