Generate all hyperparameter combinations
Company: Pinterest
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
You are given several *groups* of hyperparameter choices for an ML experiment. Each group contains one hyperparameter name and a list of candidate values.
Return **all possible configurations** (the Cartesian product across groups), where each configuration assigns **exactly one value** to each hyperparameter.
### Input
- A list of `k` hyperparameter groups, e.g.
- `[("lr", [0.1, 0.01]), ("batch", [16, 32, 64]), ("optimizer", ["sgd", "adam"])]`
### Output
- A list of configurations, each configuration represented as a map/dictionary from name → chosen value.
### Constraints / expectations
- If any group has an empty value list, the result should be empty.
- Order does not matter, but the output should not contain duplicates.
- Discuss a few test cases (including edge cases) you would use to validate the implementation.
Quick Answer: This question evaluates competence in combinatorial enumeration and manipulation of data structures for generating hyperparameter configurations, testing understanding of Cartesian products and correctness of produced configuration sets.