← Uber Interview InsightsMachine Learning Engineer

Uber·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Uber ML engineer interview, technical phone screen focused entirely on implementing logistic regression from scratch. Pretty deep dive, they wanted working code plus a discussion of the math and engineering tradeoffs. Felt more like a mini take-home crammed into a live session.

Questions Asked (2)

Q1

Implement logistic regression from scratch in Python. It needs to actually run end-to-end, including fit, predict_proba, and predict methods using gradient descent on the negative log-likelihood loss.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The 'must run end-to-end' part is what tripped me up initially.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining the logistic regression model and its loss function, then outline the gradient descent update rule. Implement the class with fit, predict_proba, and predict methods, ensuring numerical stability and vectorized operations. Test with a small synthetic dataset to demonstrate end-to-end functionality.

Pro tip: Mention that you would add L2 regularization and use a stable sigmoid implementation to avoid overflow, showing awareness of practical issues beyond the basic algorithm.

1. Define the model and loss

Explain that logistic regression models P(y=1|x) = sigmoid(w·x + b) and is trained by minimizing negative log-likelihood (log loss).

2. Derive gradients

Show that the gradient of the loss w.r.t. weights is X^T (sigmoid(Xw+b) - y) / n, and similarly for bias.

3. Implement gradient descent

Describe the iterative update: w = w - learning_rate * gradient, with options for batch or stochastic updates, and track loss for convergence.

4. Code the class methods

Implement fit (with gradient descent loop), predict_proba (apply sigmoid to linear combination), and predict (threshold probabilities at 0.5).

5. Test and validate

Run on a small dataset (e.g., make_classification) to verify it learns and compare with scikit-learn’s logistic regression for sanity check.

Key Points to Mention

  • Sigmoid function and its role in mapping linear outputs to probabilities
  • Negative log-likelihood loss and its gradient derivation
  • Gradient descent update rule and importance of learning rate
  • Vectorized implementation for efficiency
  • Numerical stability (e.g., clipping sigmoid inputs)
  • Regularization (L2) to prevent overfitting

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

Q2

How do you choose a learning rate, decide when the model has converged, and incorporate L2 regularization into logistic regression?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

They asked this as a follow-up after the code was mostly done.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer around the three sub-questions, showing a systematic approach to hyperparameter tuning and convergence detection. Emphasize practical considerations like using validation curves, early stopping, and the role of L2 regularization in preventing overfitting. Connect each choice to real-world constraints such as computational cost and model interpretability.

Pro tip: Mention that learning rate and regularization strength are often tuned jointly via grid or random search, and that convergence should be assessed on a held-out validation set, not just training loss. This shows you understand the interplay between hyperparameters and generalization.

1. Learning Rate Selection

Explain that learning rate controls step size in gradient descent. Suggest starting with a moderate value (e.g., 0.01) and using learning rate schedules or adaptive methods (e.g., Adam) if needed. Mention grid search or learning rate finder (e.g., exponential decay) to tune it.

2. Convergence Detection

Describe monitoring training and validation loss curves. Convergence is when validation loss stops improving (plateau) or starts increasing (overfitting). Use early stopping with a patience parameter to avoid overtraining.

3. L2 Regularization Integration

Explain that L2 adds a penalty term (lambda * ||w||^2) to the loss function, shrinking weights. Tune lambda via cross-validation; larger lambda increases regularization. Note that L2 is equivalent to a Gaussian prior in Bayesian terms.

4. Joint Tuning and Validation

Emphasize that learning rate and lambda should be tuned together using cross-validation. Use a validation set to evaluate combinations and select the best based on generalization performance.

5. Practical Considerations

Mention computational trade-offs: smaller learning rates and larger lambda may require more iterations. Also discuss feature scaling's impact on convergence and regularization effectiveness.

Key Points to Mention

  • Learning rate schedules (e.g., step decay, cosine annealing) and adaptive optimizers (Adam, RMSprop)
  • Early stopping based on validation loss with patience
  • L2 regularization as weight decay and its effect on the bias-variance trade-off
  • Cross-validation for hyperparameter tuning (grid/random search)
  • Feature scaling (standardization) to improve convergence and regularization
  • Monitoring both training and validation metrics to detect overfitting/underfitting

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