pdmlabs.optimization.smac_adapter#
SMAC3 optimizer adapter for PdMLabs.
All smac and ConfigSpace imports are lazy (inside method bodies)
so this module is importable even when smac is not installed.
Install SMAC3 support with:
pip install pdmlabs[smac]
The adapter uses HyperparameterOptimizationFacade as the single entry
point. Hyperparameter space conversion rules:
listwith string values →CategoricalHyperparameterlistwith numeric values →OrdinalHyperparameter(preserves the exact candidate set defined by the user)scipy.statsfrozen dist →UniformFloatHyperparameter
A unique smac_output_<hex>/ directory is created per maximize()
call to prevent file-system collisions across parallel or repeated runs.
Classes
Adapter for SMAC3 |
- class pdmlabs.optimization.smac_adapter.SMAC3Adapter#
Bases:
BaseOptimizerAdapterAdapter for SMAC3
HyperparameterOptimizationFacade.Requires
smac >= 2.0.0(pip install pdmlabs[smac]).- maximize(param_space: dict, objective_fn, n_iterations: int, n_jobs: int, initial_random: int, constraint_fn=None) dict#
Maximize objective_fn using SMAC3.
SMAC3 minimises internally; the objective is negated so SMAC effectively maximises. Results are negated back before returning.
- minimize(param_space: dict, objective_fn, n_iterations: int, n_jobs: int, initial_random: int, constraint_fn=None) dict#
Minimise objective_fn using SMAC3 directly (no negation).
- supports_categorical: bool = True#