When would you pick an SVM over logistic regression, and the other way round?
Pick logistic regression when you want calibrated probabilities, speed and interpretable coefficients. Pick an SVM (often with RBF kernel) when classes are not linearly separable and the dataset is small to medium. Both need scaled features.
Explain it simply
Logistic regression is a dependable Maruti hatchback: cheap, easy to understand, gets you there. An RBF SVM is a more flexible car that handles twisty roads (curved boundaries) but costs more to run on big highways (large datasets).
Example
Logistic regression SVM
Output probabilities scores (probability via extra step)
Boundary linear (unless you add linear or curved via kernel
features)
Interpretability coefficients -> odds hard with non-linear kernels
Training speed fast, scales to millions kernel SVM slows past ~100k rows
Loss log loss hinge loss
Decides boundary by all points support vectors onlyFor text classification with thousands of sparse features, both a linear SVM and logistic regression do well and are fast: LinearSVC or LogisticRegression.
For a 5,000-row dataset with a clearly curved boundary, an RBF SVM is a strong first try.
Scikit-learn's SVC gives probabilities only with probability=True, which adds an internal cross-validation and slows training.
What to say in the interview
"If I need probabilities, interpretability, or have a lot of data, I start with logistic regression. If the boundary is non-linear and the data is small or medium, I try an RBF SVM. Either way I scale features and tune regularisation strength by cross-validation."
Common mistakes
- Using kernel SVC on millions of rows.
- Treating SVC decision scores as probabilities.