How does Pegasos solve the linear SVM optimization problem?

Quick Overview

Asks how the Pegasos algorithm trains a linear support vector machine. Tests the primal hinge-loss objective, stochastic sub-gradient updates with a decreasing step size, the optional projection step, why the iteration count does not depend on the number of examples, and practical caveats such as bias handling.

How does Pegasos solve the linear SVM optimization problem?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Other

How does Pegasos solve the linear SVM optimization problem? ```hint Start from the objective Write the primal objective of the linear SVM and find the term that is not differentiable everywhere. What can stand in for a gradient there? ``` ```hint The step size The regularizer makes the objective strongly convex. How does that change the step-size schedule you can use, and the number of iterations you need? ``` ```hint Cost per step Count the work in one update when the example is sparse, and look for a way to avoid touching every coordinate when w only shrinks. ``` ### What a Strong Answer Covers - The primal objective and why a stochastic sub-gradient method suits it - The update for an example that violates the margin and for one that does not, with the step size - The optional projection step and why the ball it projects onto contains the optimum - The convergence rate and cost per step, and why neither depends on the number of examples - Practical caveats: the bias term, kernels, and the accuracy level the method reaches ### Follow-up Questions - Why does Pegasos use a step size of ${1/(\lambda t)}$ when general convex problems use a ${1/\sqrt{t}}$ schedule? - How would you add a bias term that is not regularized, and what does that cost? - How does a mini-batch change the update and the cost of each step? - How would you implement the scalar-times-vector representation so the shrink step is O(1) on sparse data?

Overview: Asks how the Pegasos algorithm trains a linear support vector machine. Tests the primal hinge-loss objective, stochastic sub-gradient updates with a decreasing step size, the optional projection step, why the iteration count does not depend on the number of examples, and practical caveats such as bias handling.

Nov 24, 2026
hardMachine Learning EngineerOtherMachine Learning
0
0

How does Pegasos solve the linear SVM optimization problem?

What a Strong Answer Covers Guidance

  • The primal objective and why a stochastic sub-gradient method suits it
  • The update for an example that violates the margin and for one that does not, with the step size
  • The optional projection step and why the ball it projects onto contains the optimum
  • The convergence rate and cost per step, and why neither depends on the number of examples
  • Practical caveats: the bias term, kernels, and the accuracy level the method reaches

Follow-up Questions Guidance

  • Why does Pegasos use a step size of 1/(λt){1/(\lambda t)} when general convex problems use a 1/t{1/\sqrt{t}} schedule?
  • How would you add a bias term that is not regularized, and what does that cost?
  • How does a mini-batch change the update and the cost of each step?
  • How would you implement the scalar-times-vector representation so the shrink step is O(1) on sparse data?