Softmax Regression
Softmax regression is a linear model for choosing one class from mutually exclusive classes. It produces one unnormalized score, or logit, per class:
Softmax converts the logits into nonnegative values that sum to one:
Implementations subtract the largest logit before exponentiation for numerical stability; this does not change the result because softmax is invariant to adding the same constant to every logit.
Cross-Entropy
For a one-hot target , the per-example cross-entropy is
Minimizing this objective corresponds to maximizing the conditional likelihood of the observed class labels under the model.
Boundaries
- Mutually exclusive multiclass: softmax is appropriate when exactly one class is correct.
- Multilabel: use independent outputs, commonly sigmoid probabilities with a binary loss, when several labels may be true simultaneously.
- Decision rule:
argmaxchooses a class, but asymmetric costs may require a different rule. - Probability quality: good classification accuracy does not imply calibrated probabilities.
- Linear boundary: nonlinear feature relationships require transformed features or a more expressive model.
Evaluate against class frequencies and a simple baseline, then inspect a confusion matrix and per-class errors. Aggregate accuracy can hide poor behavior on rare or important classes.
Continue with the Multilayer Perceptron to introduce nonlinear hidden representations. See Dive into Deep Learning: Linear Neural Networks for Classification for derivations and maintained implementations.