When should a numeric hyperparameter be searched as categorical or integer steps instead of a continuous range?

Quick Overview

Asks how to decide whether a numeric hyperparameter should be searched as a continuous range, integer steps, or a categorical set. Tests your reasoning about ordering, smoothness, log scales, sentinel values, and how search algorithms use each encoding.

When should a numeric hyperparameter be searched as categorical or integer steps instead of a continuous range?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

When should a numeric hyperparameter in a search space be treated as categorical or as discrete integer steps instead of a continuous range? ```hint Look at the response For each hyperparameter, ask whether nearby values behave alike and whether every value in between is even valid. ``` ```hint Think like the optimizer Consider what a search algorithm can learn about neighboring values from one trial under each encoding. ``` ### What a Strong Answer Covers - Which properties of a hyperparameter decide its encoding (ordering, smoothness, the set of valid values) - Examples of each type with the reasoning behind them - What each encoding costs the search algorithm - Practical details such as log scales, step sizes, sentinel values and grid search ### Follow-up Questions - How would you encode `max_depth` when `None` (no limit) is one of the options? - How do TPE and Gaussian-process optimizers handle integer and categorical dimensions differently? - Why sample the learning rate on a log scale, and what goes wrong on a linear one?

Overview: Asks how to decide whether a numeric hyperparameter should be searched as a continuous range, integer steps, or a categorical set. Tests your reasoning about ordering, smoothness, log scales, sentinel values, and how search algorithms use each encoding.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

When should a numeric hyperparameter in a search space be treated as categorical or as discrete integer steps instead of a continuous range?

What a Strong Answer Covers Guidance

  • Which properties of a hyperparameter decide its encoding (ordering, smoothness, the set of valid values)
  • Examples of each type with the reasoning behind them
  • What each encoding costs the search algorithm
  • Practical details such as log scales, step sizes, sentinel values and grid search

Follow-up Questions Guidance

  • How would you encode max_depth when None (no limit) is one of the options?
  • How do TPE and Gaussian-process optimizers handle integer and categorical dimensions differently?
  • Why sample the learning rate on a log scale, and what goes wrong on a linear one?