What are the properties of the cost function for logistic regression?

Quick Overview

Asks for the main properties of the logistic regression cost function and why they matter for training. Tests understanding of log-loss, how its shape affects optimization, gradient-based training, behavior on separable data and the effect of regularization.

What are the properties of the cost function for logistic regression?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What are the properties of the cost function for logistic regression? Consider binary logistic regression fit by maximum likelihood, and focus on the properties that matter when you train the model. ```hint Write it per example Write the loss for one example as a function of the linear score $z = w^\top x$ and look at its second derivative. ``` ```hint Check the edge cases Ask whether a minimum always exists, for example when a single feature splits the two classes perfectly. ``` ### What a Strong Answer Covers - The form of the cost and the probabilistic model it comes from. - The shape of the cost in the weights, with a reason, and what that shape means for optimization. - Differentiability, the form of the gradient, and whether there is a closed-form solution. - How the cost treats confident wrong predictions and how that connects to calibrated probabilities. - When a finite minimizer fails to exist or is not unique, and what regularization changes. ### Follow-up Questions - Show why squared error on a sigmoid output is non-convex in the weights. What does that do to gradient descent? - How do L1 and L2 penalties change the optimization problem and the solver you would pick? - Derive the gradient and Hessian, and explain how Newton's method (IRLS) uses them. - How would you compute the loss without overflow or log-of-zero errors when scores are large in magnitude?

Overview: Asks for the main properties of the logistic regression cost function and why they matter for training. Tests understanding of log-loss, how its shape affects optimization, gradient-based training, behavior on separable data and the effect of regularization.

Nov 25, 2026
mediumData ScientistOtherMachine Learning
0
0

What are the properties of the cost function for logistic regression? Consider binary logistic regression fit by maximum likelihood, and focus on the properties that matter when you train the model.

What a Strong Answer Covers Guidance

  • The form of the cost and the probabilistic model it comes from.
  • The shape of the cost in the weights, with a reason, and what that shape means for optimization.
  • Differentiability, the form of the gradient, and whether there is a closed-form solution.
  • How the cost treats confident wrong predictions and how that connects to calibrated probabilities.
  • When a finite minimizer fails to exist or is not unique, and what regularization changes.

Follow-up Questions Guidance

  • Show why squared error on a sigmoid output is non-convex in the weights. What does that do to gradient descent?
  • How do L1 and L2 penalties change the optimization problem and the solver you would pick?
  • Derive the gradient and Hessian, and explain how Newton's method (IRLS) uses them.
  • How would you compute the loss without overflow or log-of-zero errors when scores are large in magnitude?