Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-1160

Retune C when class weights change, because weights rescale the data term against the penalty

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist, ML engineer
Industries
banking, healthcare

Summary: situation, action, reason, boundary

  1. Situation

    You switch an SVM or logistic regression to class_weight balanced and keep the C chosen without weights.

  2. Action

    Search C again with the weights on, and compare weighted against unweighted fits on the cost metric after threshold tuning.

  3. Reason

    In the penalized objective C multiplies the data-fit term; class weights multiply it per class, so the balance of fit and penalty differs for each class.

  4. Boundary

    Penalized learners with C or an equivalent: SVC, logistic regression, linear SVM.

Symptom or risk

Weighting multiplies the loss of the rare class, which effectively loosens regularization for those rows; the model can overfit minority points that the old C kept in check.

Exceptions

With ample minority data and a mild weight, the shift is small; retuning still costs little.

Trade-offs

Weighting helps recall on scarce positives at the price of an extra tuning axis and inflated probabilities.

Pitfalls

Comparing a weighted model at C=1 against an unweighted model tuned over C.

Lessons and concepts

Claims and their sources