Why is the log-loss cost function for logistic regression convex, and why does that matter for fitting?

Quick Overview

Asks why the log-loss objective of logistic regression is convex in the weights and what that means for training. Tests the Hessian argument, global optimality, uniqueness, perfect separation and why squared error on a sigmoid is a poor substitute.

Why is the log-loss cost function for logistic regression convex, and why does that matter for fitting?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why is the log-loss cost function for logistic regression convex, and why does that matter for fitting? ```hint Work in the score Write the per-example loss as a function of the linear score $z = w^\top x$ and take its second derivative in $z$. ``` ```hint What the optimizer can promise Think about what convexity says about the points where the gradient is zero, and what happens to the weights when the two classes are perfectly separable. ``` ### What a Strong Answer Covers - A convexity argument: the per-example loss as a convex function of the linear score, or the Hessian $X^\top S X$ being positive semi-definite - What convexity guarantees for gradient descent, Newton's method and IRLS - When the minimizer is unique, and what perfect separation does to it - Why squared error on a sigmoid output does not share this property ### Follow-up Questions - Does adding L1 or L2 regularization keep the problem convex, and which of the two makes it strictly convex? - Why is a neural network trained with the same log-loss non-convex? - How is the Hessian at the optimum used to get standard errors for the coefficients? - Convexity guarantees a global minimum. What can still make gradient descent slow on logistic regression?

Overview: Asks why the log-loss objective of logistic regression is convex in the weights and what that means for training. Tests the Hessian argument, global optimality, uniqueness, perfect separation and why squared error on a sigmoid is a poor substitute.

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

Why is the log-loss cost function for logistic regression convex, and why does that matter for fitting?

What a Strong Answer Covers Guidance

  • A convexity argument: the per-example loss as a convex function of the linear score, or the Hessian X⊤SXX^\top S X being positive semi-definite
  • What convexity guarantees for gradient descent, Newton's method and IRLS
  • When the minimizer is unique, and what perfect separation does to it
  • Why squared error on a sigmoid output does not share this property

Follow-up Questions Guidance

  • Does adding L1 or L2 regularization keep the problem convex, and which of the two makes it strictly convex?
  • Why is a neural network trained with the same log-loss non-convex?
  • How is the Hessian at the optimum used to get standard errors for the coefficients?
  • Convexity guarantees a global minimum. What can still make gradient descent slow on logistic regression?