Why does choosing SGDClassifier not completely specify whether you are training a linear SVM or logistic model?
Classic MLLevel: IntermediateLoss defines the linear learner
Why does choosing SGDClassifier not completely specify whether you are training a linear SVM or logistic model?
Hints
- Separate optimizer from loss.
- One training engine supports different objectives.
Answer
SGD specifies the optimization approach. loss='hinge' gives a margin-based linear SVM objective, while loss='log_loss' gives a logistic objective; penalties further define the model.
Source and licence: scikit-learn 1.7.2 — sgd · BSD-3-Clause · answer: Quantoros editorial