Binary vs. Multiclass vs. Multi-Label Classification: OvR, OvO & Softmax
How to pick the right output head, loss function, and strategy when classifying 2 classes, K mutually exclusive classes, or multiple simultaneous tags
Classification comes in three distinct flavors: Binary (1 yes/no decision), Multiclass (pick exactly 1 winner out of K mutually exclusive classes), and Multi-Label (predict multiple independent yes/no tags for the same item).
Using Softmax on a Multi-Label problem forces tags to compete and sum to 1 (preventing a movie from being BOTH Action and Comedy!), while confusing OvR with OvO wastes compute.
Choosing Softmax vs. Independent Sigmoids is one of the most common real-world architecture bugs in NLP tagging, medical coding, and computer vision.
Using BCEWithLogitsLoss (independent sigmoids) instead of CrossEntropyLoss (softmax) is mandatory for multi-label tagging systems.
Knowing Macro-F1 vs. Micro-F1 prevents rare classes from being hidden by a dominant majority class.
Classic question: 'A photo can contain a dog, a car, and a tree all at once. Why does Softmax fail here, and what should you use instead?'
You have K = 10 mutually exclusive classes (handwritten digits 0–9) and want to extend a binary SVM using One-vs-One (OvO). How many binary SVMs are trained?
- Distinguish Binary, Multiclass, and Multi-Label classification on sight.
- Choose the right activation & loss for each: Sigmoid + BCE (Binary), Softmax + Categorical CE (Multiclass), Independent Sigmoids + BCE (Multi-Label).
- Compare One-vs-Rest (OvR: K classifiers) vs. One-vs-One (OvO: K(K−1)/2 classifiers) for extending binary models like SVM.
- Pick Macro vs. Micro vs. Weighted F1 for multi-class evaluation.
Ask one simple question: Can two labels be true at the exact same time? If No (a digit cannot be both 3 and 8) → Multiclass with Softmax. If Yes (an article can be both Tech and Finance) → Multi-Label with K independent Sigmoids!
1. The 3 Classification Setups Side by Side
| Type | Labels per Row | Output Activation | Loss Function | Example |
|---|---|---|---|---|
| Binary | 1 of 2 () | 1 Sigmoid | Binary Cross-Entropy | Fraud / Spam |
| Multiclass | Exactly 1 of | Softmax () | Categorical Cross-Entropy | Digit 0–9, Language ID |
| Multi-Label | 0, 1, or many of | Independent Sigmoids | Sum of Binary Cross-Entropies | Movie genres, Medical ICD tags |
2. One-vs-Rest (OvR) vs. One-vs-One (OvO)
When using a strictly binary algorithm (like classic SVM) on classes:
- One-vs-Rest (OvR): Train classifiers (Class vs. all other classes). Fast ( models), but each sub-problem is imbalanced.
- One-vs-One (OvO): Train classifiers (every pair of classes). Each model sees a tiny balanced slice, great for slow Kernel SVMs when is modest.
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
Macro-F1 averages the F1 score of every class equally (so a rare 1% class counts just as much as a 90% class). Micro-F1 pools all predictions together (in single-label multiclass, Micro-F1 equals plain Accuracy!).
Tune Steepness w & Boundary Shift x₀ to Minimize Log-Loss
import numpy as np
# Multiclass Softmax (sums to 1) vs. Multi-Label Independent Sigmoids (can all be high!)
logits = np.array([2.4, 2.1, -1.8]) # raw scores for [Action, Comedy, Horror]
# 1. Multiclass Softmax (forces mutually exclusive competition)
shifted = logits - logits.max()
softmax_probs = np.exp(shifted) / np.exp(shifted).sum()
# 2. Multi-Label Independent Sigmoids (each genre judged independently)
sigmoid_probs = 1.0 / (1.0 + np.exp(-logits))
print("Softmax (Multiclass, sum=1): ", np.round(softmax_probs, 3).tolist())
print("Sigmoids (Multi-Label, indep.): ", np.round(sigmoid_probs, 3).tolist())
print("Predicted Multi-Label tags (>0.5):", [g for g, p in zip(["Action", "Comedy", "Horror"], sigmoid_probs) if p > 0.5])