What is the difference between a stochastic gradient descent classifier and logistic regression?

Quick Overview

Asks how a stochastic gradient descent classifier relates to logistic regression and when to use each. Tests what each name refers to, the scikit-learn defaults of SGDClassifier and LogisticRegression, matching regularization, and training on large or streaming data.

What is the difference between a stochastic gradient descent classifier and logistic regression?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What is the difference between a stochastic gradient descent classifier and logistic regression? Answer in terms of scikit-learn's `SGDClassifier` and `LogisticRegression` where it helps. ```hint Change one argument Look at what happens when you change the `loss` argument of `SGDClassifier`, and what stays the same. ``` ```hint Check the defaults Look at what each class optimizes with its default arguments, including the loss and the regularization. ``` ### What a Strong Answer Covers - What each name refers to and how the two classes relate. - How each class trains, and what that means for convergence, dataset size and online learning. - The settings an SGD classifier needs to fit the same model as the logistic regression class. - Practical sensitivities such as learning rate and feature scaling, and when to choose each. ### Follow-up Questions - How would you set `SGDClassifier`'s `alpha` to match a `LogisticRegression` model trained with `C=1.0`? - Why does SGD depend on feature scaling more than L-BFGS does? - How would you train a logistic regression on data that does not fit in memory? - When would the hinge or modified Huber loss be a better choice than log loss?

Overview: Asks how a stochastic gradient descent classifier relates to logistic regression and when to use each. Tests what each name refers to, the scikit-learn defaults of SGDClassifier and LogisticRegression, matching regularization, and training on large or streaming data.

PracHub logo
General
Nov 24, 2026
mediumData ScientistOtherMachine Learning
0
0

What is the difference between a stochastic gradient descent classifier and logistic regression?

Answer in terms of scikit-learn's SGDClassifier and LogisticRegression where it helps.

What a Strong Answer Covers Guidance

  • What each name refers to and how the two classes relate.
  • How each class trains, and what that means for convergence, dataset size and online learning.
  • The settings an SGD classifier needs to fit the same model as the logistic regression class.
  • Practical sensitivities such as learning rate and feature scaling, and when to choose each.

Follow-up Questions Guidance

  • How would you set SGDClassifier 's alpha to match a LogisticRegression model trained with C=1.0 ?
  • Why does SGD depend on feature scaling more than L-BFGS does?
  • How would you train a logistic regression on data that does not fit in memory?
  • When would the hinge or modified Huber loss be a better choice than log loss?