PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Machine Learning/Upstart

Derive logistic regression objective and gradients

Last updated: Apr 19, 2026

Quick Overview

This question evaluates understanding of logistic regression, maximum likelihood estimation, cross-entropy (negative log-likelihood), L2 regularization, and the ability to compute model gradients for binary classification.

  • easy
  • Upstart
  • Machine Learning
  • Data Scientist

Derive logistic regression objective and gradients

Company: Upstart

Role: Data Scientist

Category: Machine Learning

Difficulty: easy

Interview Round: HR Screen

Binary logistic regression with dataset {(x_i, y_i)}_{i=1}^m, y_i ∈ {0,1}. Using the sigmoid σ(z)=1/(1+e^{-z}) and linear score z_i = w^T x_i + b: a) Write the exact maximum-likelihood optimization objective (state clearly whether it is a maximization or minimization) both without and with L2 regularization of strength λ≥0. b) Write the explicit negative log-likelihood (cross-entropy) L(w,b). c) Derive the gradients ∂L/∂w and ∂L/∂b. d) Clarify the distinction among 'objective', 'loss', and 'regularized objective' in this context.

Quick Answer: This question evaluates understanding of logistic regression, maximum likelihood estimation, cross-entropy (negative log-likelihood), L2 regularization, and the ability to compute model gradients for binary classification.

Related Interview Questions

  • Explain L1 vs L2 and ridge vs lasso - Upstart (easy)
  • Implement PAVA spend-smoothing under no-borrowing constraint - Upstart (hard)
  • Address Missing Income Bracket in California Housing Data - Upstart (hard)
  • Design Push-Notification System for Airport Surge Pricing - Upstart (medium)
  • How to Architect a Personalized Ads Serving System - Upstart (hard)
Upstart logo
Upstart
Oct 13, 2025, 9:49 PM
Data Scientist
HR Screen
Machine Learning
3
0

Context: Binary Logistic Regression

You are given a binary classification dataset {(x_i, y_i)}_{i=1}^m with labels y_i ∈ {0, 1}. The model uses the sigmoid function σ(z) = 1/(1 + e^{-z}) and a linear score z_i = w^T x_i + b.

Answer the following:

(a) Write the exact maximum-likelihood optimization objective (state clearly whether it is a maximization or a minimization) both without and with L2 regularization of strength λ ≥ 0.

(b) Write the explicit negative log-likelihood (cross-entropy) L(w, b).

(c) Derive the gradients ∂L/∂w and ∂L/∂b.

(d) Clarify the distinction among "objective", "loss", and "regularized objective" in this context.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More Upstart•More Data Scientist•Upstart Data Scientist•Upstart Machine Learning•Data Scientist Machine Learning
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.