← Back to Classic ML Mind Map
📊 Classic MLID: multiclass-strategies

Multiclass Strategies: OvR/OvO/Softmax

多分类 OvR/OvO/Softmax
🎯Core Definition
three main strategies extend binary classifiers to KK classes. OvR (one-vs-rest): train KK 'class-vs-others' classifiers and predict by the highest score, O(K⋅d)O(K \cdot d) parameters; OvO (one-vs-one): train (K2)=K(K−1)2\binom{K}{2} = \frac{K(K-1)}{2} pairwise classifiers and vote, simpler per model but O(K2)O(K^2) total cost; Softmax (direct multiclass): a single model outputs KK-dim probabilities pi=ezi/τ∑j=1Kezj/τp_i = \frac{e^{z_i/\tau}}{\sum_{j=1}^{K} e^{z_j/\tau}}, with temperature τ\tau controlling smoothness — τ→0\tau \to 0 collapses to argmax, τ→∞\tau \to \infty approaches uniform; with cross-entropy the gradient is still p−yp - y (Softmax is the multiclass logistic regression).
💡Use Cases
interview comparisons of the three (model count / parameters / expressiveness), the role of τ\tau in knowledge distillation and probability calibration, and why OvR scores are not probabilities.
⚡Key Problems Solved
OvR trains each class against 'the rest', suffers severe class imbalance, and the KK scores are not comparable (need calibration, e.g. Platt scaling); OvO's model count explodes as (K2)\binom{K}{2} (K=100K=100 → 4950 models) with possible voting ties; Softmax trains one model end-to-end and natively outputs valid probabilities, but assumes mutually exclusive classes (use multiple binary classifiers otherwise). Temperature additionally shapes the distribution: distillation uses τ>1\tau > 1 to soften labels and transfer dark knowledge (inference at τ=1\tau = 1); τ\tau also affects confidence and calibration.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Multiclass Strategies: OvR/OvO/Softmax.
Use Cases
In production engineering, what are the primary use cases for Multiclass Strategies: OvR/OvO/Softmax and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
OvR vs OvO: number of models (KK vs K(K−1)2\frac{K(K-1)}{2}), training/inference cost, tie-breaking; how many models for K=100K=100?
2
Role of Softmax temperature τ\tau: derive the limits as τ→0\tau \to 0 and τ→∞\tau \to \infty; why use τ>1\tau > 1 in distillation?
3
Whiteboard the Softmax + cross-entropy gradient ∂L∂zi=pi−yi\frac{\partial L}{\partial z_i} = p_i - y_i and show it generalizes binary LR.
4
Why aren't OvR scores probabilities? How to calibrate (Platt scaling / Isotonic) and how does calibration differ from AUC?
5
The mutual-exclusion assumption: what tasks fit Softmax, why do multi-label tasks use per-class Sigmoid? When to pick OvR vs OvO vs Softmax?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Multiclass Strategies: OvR/OvO/Softmax"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardLogistic RegressionNext Card →SVM Margin & Duality

🔗 More Classic ML Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/ML/card/multiclass-strategies
中文速览与面试要点

多分类 OvR/OvO/Softmax (Multiclass Strategies: OvR/OvO/Softmax)

定义: 把二分类器扩展到 K 类有三种主流策略。OvR (一对余): 训练 K 个“该类 vs 其余”的分类器, 预测取得分最高者, 参数量 O(K d); OvO (一对一): 训练 K2 = K(K-1)2 个两两分类器, 投票裁决, 单模型更简单但总成本 O(K^2); Softmax (直接多分类): 单个模型输出 K 维概率 p_i = e^z_i/ _j=1^K e^z_j/ , 温度 控制平滑度—— 0 退化为 argmax, 趋于均匀分布; 配合交叉熵损失梯度仍为 p - y (Softmax 是多分类的 Logistic)。 使用场景: 面试常考三者对比 (模型数/参数量/表达能力)、温度 在知识蒸馏与概率校准中的作用、OvR 得分为何不能当概率。 解决的问题: OvR 每类只拿“自己 vs 其余”训练, 类别不平衡严重且 K 个分类器得分不可比 (需校准, 如 Platt scaling); OvO 在 K 大时模型数随 K2 爆炸 (K=100 要 4950 个模型), 且投票可能平票; Softmax 单模型端到端训练、天然输出合法概率, 但要求类别互斥 (非互斥任务用多个二分类)。温度 额外提供分布塑形能力: 蒸馏时 > 1 软化标签传递暗知识, 推理用 = 1; 也影响预测置信度与校准质量。

核心要点

  • OvR vs OvO 对比: 模型数量 (K vs K(K-1)2)、训练/推理成本、投票平局问题, K=100 时各需要多少个模型?
  • Softmax 温度 的作用: 推导 0 与 的极限, 蒸馏中为什么用 > 1?
  • 白板推导 Softmax + 交叉熵的梯度 L z_i = p_i - y_i, 并说明它是二分类 LR 的推广。
  • OvR 的得分为什么不是概率? 如何校准 (Platt scaling / Isotonic), 校准与 AUC 有何区别?
  • 类别互斥假设: Softmax 适合什么任务, 多标签任务为什么该用多个 Sigmoid? OvR/OvO/Softmax 何时选哪个?