← Uber Interview Insights

Uber·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026

Summary

Uber ML engineer interview that went pretty deep on the fundamentals. The question sounds straightforward until you're actually writing out gradient derivations on the spot and trying to remember the difference between BCE and MSE loss without Googling anything.

Questions Asked (1)

Q1

Implement linear regression and logistic regression from scratch, covering the prediction function, loss function, gradient computation, gradient descent training, regularization, and when you'd use one over the other.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is one of those questions that feels like a gimme until you're 10 minutes in and fumbling through the chain rule for logistic loss.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining the problem and the mathematical foundations for both linear and logistic regression, then walk through the implementation steps in a structured manner, covering prediction, loss, gradients, and training. Emphasize the differences in loss functions and regularization, and conclude with practical considerations for when to use each model.

Pro tip: Demonstrate production awareness by discussing numerical stability (e.g., log-sum-exp trick for logistic loss) and how regularization ties into Uber's scale and feature sparsity.

1. Define the Models and Prediction Functions

Explain the hypothesis for linear regression (linear combination) and logistic regression (sigmoid of linear combination), including the role of weights and bias.

2. Specify Loss Functions and Their Rationale

Derive mean squared error for linear regression and cross-entropy (log loss) for logistic regression, highlighting why each is appropriate (e.g., Gaussian noise assumption vs. maximum likelihood).

3. Compute Gradients and Derive Update Rules

Show the gradient of the loss with respect to weights for both models, noting the similarity in form (error times input) and how it leads to gradient descent updates.

4. Implement Gradient Descent with Regularization

Describe the iterative update process, including learning rate, convergence criteria, and how to incorporate L1/L2 regularization by adding a penalty term to the loss and its gradient.

5. Compare and Choose Between Models

Discuss when to use linear regression (continuous target, interpretability) versus logistic regression (binary classification, probabilistic outputs), and the impact of regularization on model complexity.

Key Points to Mention

  • Difference in loss functions: MSE vs. cross-entropy, and their probabilistic interpretations.
  • Gradient computation: for linear regression, gradient = (1/m) * X^T (Xw - y); for logistic regression, gradient = (1/m) * X^T (sigmoid(Xw) - y).
  • Gradient descent variants: batch, stochastic, mini-batch, and considerations for convergence.
  • Regularization: L1 (Lasso) for sparsity, L2 (Ridge) for smoothness, and elastic net; how to add to loss and gradients.
  • When to use each: linear for regression tasks, logistic for classification; logistic outputs probabilities and can handle non-linear decision boundaries with feature engineering.
  • Practical considerations: feature scaling, handling imbalanced data in logistic regression, and computational efficiency for large datasets.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.