How does computational cost scale with the number of classes for One-vs-Rest versus One-vs-One?

Quick Overview

Asks how training and inference cost grow with the number of classes under One-vs-Rest and One-vs-One multiclass strategies. Tests whether you can reason about model counts, subproblem sizes and the base learner's scaling, and pick a strategy for large class counts.

How does computational cost scale with the number of classes for One-vs-Rest versus One-vs-One?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does computational cost scale with the number of classes for One-vs-Rest versus One-vs-One? ```hint Size each subproblem Work out how many binary models each scheme trains and how many samples each one sees, assuming the K classes are balanced. ``` ```hint Vary the base learner Plug in a training cost that grows linearly with the sample count and one that grows with its square, then compare the totals. ``` ### What a Strong Answer Covers - The number of binary models and the training-set size of each one under both schemes - Total training cost as a function of how the base learner scales with n, for linear and superlinear learners - Inference cost and memory as K grows - Practical guidance on when each scheme fits, including native multiclass models - How class imbalance changes the comparison ### Follow-up Questions - How does the comparison change when the classes are heavily imbalanced? - Which strategy does scikit-learn's `SVC` use internally, and why does it make sense for kernel SVMs? - How does OvO turn the pairwise decisions into one prediction, and what happens on ties? - With 10,000 classes, what would you use instead of either scheme?

Overview: Asks how training and inference cost grow with the number of classes under One-vs-Rest and One-vs-One multiclass strategies. Tests whether you can reason about model counts, subproblem sizes and the base learner's scaling, and pick a strategy for large class counts.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does computational cost scale with the number of classes for One-vs-Rest versus One-vs-One?

What a Strong Answer Covers Guidance

  • The number of binary models and the training-set size of each one under both schemes
  • Total training cost as a function of how the base learner scales with n, for linear and superlinear learners
  • Inference cost and memory as K grows
  • Practical guidance on when each scheme fits, including native multiclass models
  • How class imbalance changes the comparison

Follow-up Questions Guidance

  • How does the comparison change when the classes are heavily imbalanced?
  • Which strategy does scikit-learn's SVC use internally, and why does it make sense for kernel SVMs?
  • How does OvO turn the pairwise decisions into one prediction, and what happens on ties?
  • With 10,000 classes, what would you use instead of either scheme?