Skip to main content
Version: v2603

intelligence.zenith_tune.strategies.base

Base class for tuning strategies.

This module defines the TuningStrategy abstract base class that encapsulates the logic for exploring hyperparameters during optimization.

TuningStrategy Objects

class TuningStrategy(ABC)

Abstract base class for tuning strategies.

A strategy determines how to explore the hyperparameter search space. It receives a search space, direction, and an evaluation function, then drives the optimization loop internally.

The eval_fn is a callable that takes a parameter dict and returns the objective value (or None on failure). Each call to eval_fn corresponds to one trial (command execution, evaluation, logging, and recording).

The strategy runs until it naturally completes (e.g., grid exhausted, convergence reached). The caller controls the trial budget externally by raising TrialExhausted from eval_fn when the limit is reached.

Example:

class MyStrategy(TuningStrategy): def optimize(self, search_space, direction, eval_fn): while True: params = self._pick(search_space) value = eval_fn(params)

optimize

@abstractmethod
def optimize(eval_fn: Callable[[Dict[str, Any]], Optional[float]],
search_space: Dict[str, Parameter], direction: Direction) -> None

Run the optimization loop.

Arguments:

  • eval_fn - Callable that executes one trial. Takes a parameter dict and returns the objective value, or None if the trial failed. Raises TrialExhausted when the trial budget is exceeded.
  • search_space - Dictionary mapping parameter names to Parameter definitions (IntParameter, FloatParameter, etc.).
  • direction - Optimization direction (MINIMIZE or MAXIMIZE).