What is the difference between SGDClassifier and LogisticRegression in Scikit-Learn?

Updated May 17, 2026

Short answer

SGDClassifier uses stochastic gradient descent optimization, while LogisticRegression uses more stable solvers like LBFGS or Newton methods.

Deep explanation

LogisticRegression in Scikit-Learn solves the optimization problem using deterministic solvers (lbfgs, liblinear, saga), which converge steadily and are suitable for small to medium datasets. SGDClassifier instead uses stochastic gradient descent, updating weights per sample or mini-batch. This makes SGDClassifier scalable for very large datasets and online learning but introduces more variance in convergence behavior. Both can optimize logistic loss, but SGD is more flexible and scalable.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Scikit-Learn interview questions

View all →