How do class weights adjust the soft-margin SVM objective to handle class imbalance?

Quick Overview

Asks how per-class weights change the soft-margin SVM objective and its dual when one class is much rarer than the other. Tests whether you can connect slack penalties to boundary placement, choose weights such as inverse frequency, pick suitable metrics, and explain the limits of weighting for probabilities and separable data.

How do class weights adjust the soft-margin SVM objective to handle class imbalance?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How do class weights adjust the soft-margin SVM objective to handle class imbalance? Explain where the weights enter the optimization problem and what they change about the learned boundary. ```hint Count the slack Suppose there are 990 negatives and 10 positives sharing one penalty $C$. Compare how much each class can contribute to the total slack penalty. ``` ```hint Look at the dual Find the constraint in the dual problem that depends on $C$, and think about what it would mean to set it differently for each point. ``` ### What a Strong Answer Covers - The weighted primal objective and how a per-class penalty enters it. - The effect on the dual problem, in particular the bound on each multiplier. - Why an unweighted SVM on imbalanced data leaves the boundary skewed into the minority region. - How to choose the weights and which metrics to tune them against. - Limits of weighting: probabilities, separable data, and alternatives such as threshold tuning or resampling. ### Follow-up Questions - Your balanced SVM now has high minority recall but poor precision. What would you change? - How does class weighting compare with duplicating minority points, and with synthetic oversampling? - You need calibrated probabilities from a weighted SVM. How would you get them? - What effect do the class weights have when the data are linearly separable and $C$ is very large?

Overview: Asks how per-class weights change the soft-margin SVM objective and its dual when one class is much rarer than the other. Tests whether you can connect slack penalties to boundary placement, choose weights such as inverse frequency, pick suitable metrics, and explain the limits of weighting for probabilities and separable data.

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

How do class weights adjust the soft-margin SVM objective to handle class imbalance? Explain where the weights enter the optimization problem and what they change about the learned boundary.

What a Strong Answer Covers Guidance

  • The weighted primal objective and how a per-class penalty enters it.
  • The effect on the dual problem, in particular the bound on each multiplier.
  • Why an unweighted SVM on imbalanced data leaves the boundary skewed into the minority region.
  • How to choose the weights and which metrics to tune them against.
  • Limits of weighting: probabilities, separable data, and alternatives such as threshold tuning or resampling.

Follow-up Questions Guidance

  • Your balanced SVM now has high minority recall but poor precision. What would you change?
  • How does class weighting compare with duplicating minority points, and with synthetic oversampling?
  • You need calibrated probabilities from a weighted SVM. How would you get them?
  • What effect do the class weights have when the data are linearly separable and CC is very large?