PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Machine Learning/Uber

Implement 1D convex minimization in Python

Last updated: Jun 15, 2026

Quick Overview

An Uber Machine Learning Engineer technical-screen question on derivative-free 1D convex optimization: minimize a black-box convex function on a closed interval using only function evaluations. It tests method selection (golden-section vs ternary search), stopping criteria and tolerances, function-evaluation and time/space complexity analysis, and robust handling of flat regions, boundary optima, noisy evaluations, and numerical precision.

  • medium
  • Uber
  • Machine Learning
  • Machine Learning Engineer

Implement 1D convex minimization in Python

Company: Uber

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Technical Screen

##### Question Implement, in Python, an algorithm that minimizes a 1D black-box convex function `F(x)` over a closed interval `[a, b]`. Assume `F` is convex (hence unimodal) on `[a, b]`, gradients are unavailable, and you may use only function evaluations. Your answer should address all of the following: 1. **Method selection and justification.** Choose an appropriate derivative-free method (e.g., golden-section search or ternary search) and justify the choice, especially with respect to the number of function evaluations each requires. 2. **Stopping criteria and tolerances.** Specify your stopping rules (absolute/relative tolerance on the bracket width, an optional function-value tolerance, and a maximum-iteration / evaluation-budget guardrail). 3. **Complexity and function-evaluation count.** Analyze time and space complexity and the number of function evaluations needed to reach a given tolerance. 4. **Robustness to edge cases.** Explain how you handle: - non-strict convexity and flat regions, - boundary optima (the minimum at `a` or `b`), - noisy function evaluations, - numerical precision near machine epsilon, and invalid inputs. 5. **Working code.** Provide a complete, runnable implementation. 6. **Testing and verification.** Explain how you would test and verify correctness.

Quick Answer: An Uber Machine Learning Engineer technical-screen question on derivative-free 1D convex optimization: minimize a black-box convex function on a closed interval using only function evaluations. It tests method selection (golden-section vs ternary search), stopping criteria and tolerances, function-evaluation and time/space complexity analysis, and robust handling of flat regions, boundary optima, noisy evaluations, and numerical precision.

Related Interview Questions

  • Evaluate Promotions for Uber Eats Users - Uber (medium)
  • Implement Streaming Clustering for Numbers - Uber
  • Build cold-start restaurant ratings - Uber (medium)
  • Implement CLIP Contrastive Loss - Uber (medium)
  • Predict driver acceptance - Uber (medium)
Uber logo
Uber
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Machine Learning
14
0
Question

Implement, in Python, an algorithm that minimizes a 1D black-box convex function F(x) over a closed interval [a, b]. Assume F is convex (hence unimodal) on [a, b], gradients are unavailable, and you may use only function evaluations.

Your answer should address all of the following:

  1. Method selection and justification. Choose an appropriate derivative-free method (e.g., golden-section search or ternary search) and justify the choice, especially with respect to the number of function evaluations each requires.
  2. Stopping criteria and tolerances. Specify your stopping rules (absolute/relative tolerance on the bracket width, an optional function-value tolerance, and a maximum-iteration / evaluation-budget guardrail).
  3. Complexity and function-evaluation count. Analyze time and space complexity and the number of function evaluations needed to reach a given tolerance.
  4. Robustness to edge cases. Explain how you handle:
    • non-strict convexity and flat regions,
    • boundary optima (the minimum at a or b ),
    • noisy function evaluations,
    • numerical precision near machine epsilon, and invalid inputs.
  5. Working code. Provide a complete, runnable implementation.
  6. Testing and verification. Explain how you would test and verify correctness.

Solution

Show

Submit Your Answer

Earn up to 20 XP/day for approved answers

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More Uber•More Machine Learning Engineer•Uber Machine Learning Engineer•Uber Machine Learning•Machine Learning Engineer Machine Learning
PracHub

Master your tech interviews with 8,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.