PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Machine Learning/Pinterest

Optimize Hyper-parameter Search to Prevent Combinatorial Explosion

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in enumerating Cartesian-product hyperparameter combinations using memory-efficient lazy generation and an understanding of strategies for managing combinatorial explosion in hyperparameter search.

  • medium
  • Pinterest
  • Machine Learning
  • Data Scientist

Optimize Hyper-parameter Search to Prevent Combinatorial Explosion

Company: Pinterest

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Onsite

##### Scenario Hyper-parameter optimisation service must enumerate every grid-search combination. ##### Question Write a generator that yields all combinations of values from a dict such as {'learning_rate':[0.1,0.2], 'feature':['A','B'], 'batch':[10,20]}. What alternatives exist to reduce explosion when grids are huge? ##### Hints Use recursive backtracking or itertools.product; discuss random search, Bayesian optimisation, Sobol sampling.

Quick Answer: This question evaluates proficiency in enumerating Cartesian-product hyperparameter combinations using memory-efficient lazy generation and an understanding of strategies for managing combinatorial explosion in hyperparameter search.

Related Interview Questions

  • Explain overfitting, underfitting, and regularization - Pinterest (hard)
  • Answer core ML fundamentals questions - Pinterest (hard)
  • Implement Naive Bayes classifier from scratch - Pinterest (hard)
  • Implement bagging with decision trees - Pinterest (hard)
  • Explain bias–variance, overfitting, and vanishing gradients - Pinterest (medium)
Pinterest logo
Pinterest
Jul 12, 2025, 6:59 PM
Data Scientist
Onsite
Machine Learning
24
0

Enumerate Grid-Search Hyperparameter Combinations and Manage Explosion

Context

You are building a hyper-parameter optimization service that must enumerate every grid-search combination. The input is a Python dict mapping parameter names to candidate values, e.g.,

  • {'learning_rate': [0.1, 0.2], 'feature': ['A', 'B'], 'batch': [10, 20]}

Tasks

  1. Write a Python generator that lazily yields all combinations as dicts (memory efficient, supports any number of parameters).
  2. Briefly discuss practical alternatives to avoid combinatorial explosion when grids are huge.

Notes

  • You may use recursive backtracking or itertools.product.
  • Mention strategies such as random search, Bayesian optimization, and Sobol/low-discrepancy sampling.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More Pinterest•More Data Scientist•Pinterest Data Scientist•Pinterest 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.