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
Situation
You switch an SVM or logistic regression to class_weight balanced and keep the C chosen without weights.
Action
Search C again with the weights on, and compare weighted against unweighted fits on the cost metric after threshold tuning.
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.
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
For SVC, class_weight sets the parameter C of class i to class_weight[i]*C, and sample_weight rescales C per sample.