Score Vector
A model often produces more than one score.
For example, a classifier with three classes may produce:
scores = [1.2, -0.4, 2.1]
Each entry is a score for one class. The largest score is usually the model's current choice before probabilities are computed.
For a batch:
X shape: (batch, input_features)
W shape: (input_features, classes)
b shape: (classes)
the score matrix has shape:
scores shape: (batch, classes)
Each row contains the class scores for one example.
One example
If:
x shape: (4)
W shape: (4, 3)
b shape: (3)
then:
xW + b shape: (3)
The model returns 3 scores.
A classifier has 5 classes. For one input example, how many raw scores should it produce?
Compute it first, then check your number.
HintScores match classes
Each class needs a score before the model can choose among them.
SolutionWork it out
With 5 classes, the score vector has 5 entries.
X has shape (8, 6), W has shape (6, 4), and b has shape (4). What is the shape of the score matrix?
Compute it first, then check your number.
HintUse batch and classes
(8, 6) x (6, 4) gives (8, 4).
SolutionWork it out
XW has shape (8, 4). The bias has one value per class and broadcasts
across the 8 examples, so the score matrix has shape (8, 4).