Can you derive the maximum likelihood estimator for logistic regression?

Quick Overview

A machine learning theory question asking you to derive the maximum likelihood estimator for logistic regression from the Bernoulli likelihood. It tests the gradient derivation, why the score equations need a numerical solver, and when the estimate fails to exist.

Can you derive the maximum likelihood estimator for logistic regression?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Can you derive the maximum likelihood estimator for logistic regression? Assume binary labels $y_i \in \{0, 1\}$ and a linear score $w^\top x_i$ whose features include an intercept. Write down the likelihood, derive its gradient, and explain how the estimate is computed. ```hint Start from one observation Write the probability of a single label $y_i$ as one expression that works for both $y_i = 0$ and $y_i = 1$. ``` ```hint A derivative that simplifies Express the derivative of the sigmoid in terms of the sigmoid itself before you apply the chain rule. ``` ### What a Strong Answer Covers - The Bernoulli likelihood written as a single product, and its log - The sigmoid derivative identity and a clean chain-rule step to the gradient - The score equations and why they have no closed-form solution in general - How the estimate is computed numerically, including the Hessian or the IRLS update - When the maximum fails to exist or is not unique ### Follow-up Questions - Show that the log-likelihood is concave. What does that guarantee about the optimizer? - What happens to the estimate when the classes are perfectly separable, and how do you fix it? - How do the gradient and Hessian change with an L2 penalty? - With an intercept in the model, what do the score equations say about the fitted probabilities?

Overview: A machine learning theory question asking you to derive the maximum likelihood estimator for logistic regression from the Bernoulli likelihood. It tests the gradient derivation, why the score equations need a numerical solver, and when the estimate fails to exist.

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

Can you derive the maximum likelihood estimator for logistic regression?

Assume binary labels yi∈{0,1}y_i \in \{0, 1\} and a linear score w⊤xiw^\top x_i whose features include an intercept. Write down the likelihood, derive its gradient, and explain how the estimate is computed.

What a Strong Answer Covers Guidance

  • The Bernoulli likelihood written as a single product, and its log
  • The sigmoid derivative identity and a clean chain-rule step to the gradient
  • The score equations and why they have no closed-form solution in general
  • How the estimate is computed numerically, including the Hessian or the IRLS update
  • When the maximum fails to exist or is not unique

Follow-up Questions Guidance

  • Show that the log-likelihood is concave. What does that guarantee about the optimizer?
  • What happens to the estimate when the classes are perfectly separable, and how do you fix it?
  • How do the gradient and Hessian change with an L2 penalty?
  • With an intercept in the model, what do the score equations say about the fitted probabilities?