How do categorical hyperparameters complicate distance-based search spaces?
Quick Overview
Asks why categorical hyperparameters, such as the optimizer type, cause trouble for search methods that rely on distances between configurations, like Gaussian-process Bayesian optimization. Tests knowledge of encodings, conditional search spaces and the surrogate models used for mixed spaces.
How do categorical hyperparameters complicate distance-based search spaces?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
How do categorical hyperparameters complicate distance-based search spaces?
Many hyperparameter search methods, such as Bayesian optimization with a Gaussian-process surrogate, rely on a distance or kernel between configurations. Some hyperparameters are categorical: the optimizer (adam, sgd, rmsprop), the activation function, the model family.
```hint Start from the kernel
A GP kernel says that configurations close in input space should score alike. Ask what "close" means between adam and sgd once you turn them into numbers.
```
```hint Follow the acquisition step
Think about the points the acquisition optimizer proposes when it searches a continuous relaxation of a one-hot block.
```
### What a Strong Answer Covers
- Why a distance-based surrogate needs a meaningful notion of closeness, and why categorical values do not have one
- What integer encoding and one-hot encoding each do to the kernel and to the acquisition optimizer
- How mixed continuous and categorical dimensions, and parameters that exist only for some categories, make distances harder to define
- Practical remedies (other surrogates, categorical kernels, splitting the search) and when each fits
### Follow-up Questions
- How does TPE handle a parameter like `momentum` that only exists when the optimizer is sgd?
- With one categorical of 3 values and four continuous parameters, would you enumerate the categories or use a mixed kernel? Does the answer change at 30 values?
- Why can rounding one-hot proposals make Bayesian optimization evaluate the same configuration again and again?
- How would you set kernel length-scales when the space mixes learning rate, batch size and optimizer type?
Overview: Asks why categorical hyperparameters, such as the optimizer type, cause trouble for search methods that rely on distances between configurations, like Gaussian-process Bayesian optimization. Tests knowledge of encodings, conditional search spaces and the surrogate models used for mixed spaces.
How do categorical hyperparameters complicate distance-based search spaces?
Many hyperparameter search methods, such as Bayesian optimization with a Gaussian-process surrogate, rely on a distance or kernel between configurations. Some hyperparameters are categorical: the optimizer (adam, sgd, rmsprop), the activation function, the model family.
What a Strong Answer Covers Guidance
Why a distance-based surrogate needs a meaningful notion of closeness, and why categorical values do not have one
What integer encoding and one-hot encoding each do to the kernel and to the acquisition optimizer
How mixed continuous and categorical dimensions, and parameters that exist only for some categories, make distances harder to define
Practical remedies (other surrogates, categorical kernels, splitting the search) and when each fits
Follow-up Questions Guidance
How does TPE handle a parameter like
momentum
that only exists when the optimizer is sgd?
With one categorical of 3 values and four continuous parameters, would you enumerate the categories or use a mixed kernel? Does the answer change at 30 values?
Why can rounding one-hot proposals make Bayesian optimization evaluate the same configuration again and again?
How would you set kernel length-scales when the space mixes learning rate, batch size and optimizer type?