Optuna Utilities

SkiNet.Utils.mlops.optuna_utils.validate_search_space(search_space: dict[str, List[int | float]], expected_keys: Set[str] | None = None) None[source]

Validate search space parameters against the keys the objective function reads.

Parameters:
  • search_space – Search space parameters

  • expected_keys – Keys the objective function reads from search_space. Defaults to the full HyperparamKey set used by the Optuna sweep.

Raises:

ValueError – If search space keys do not match expected_keys

SkiNet.Utils.mlops.optuna_utils.scale_lr(lr: float, batch_size: int, base_batch_size: int) float[source]

Scale learning rate linearly with batch size.

Parameters:
  • lr – Learning rate calibrated at base_batch_size

  • batch_size – Target batch size for this trial

  • base_batch_size – Reference batch size at which lr is calibrated

Returns:

Scaled learning rate