cursus.steps.configs.config_tuning_step_base

Hyperparameter-Tuning Step Configuration Mixin (the search axis).

The Tuning construction verb (FZ 31e1d3p) wraps a training step’s estimator in a SageMaker HyperparameterTuner and builds a TuningStep. A tuning job is a training job with a search wrapper, so a concrete tuning config REUSES the wrapped training config’s fields (image, instance type, channels — everything the estimator factory reads) and adds ONLY the search fields this mixin supplies. The idiomatic composition is multiple inheritance:

class GraphStormGNNTuningConfig(GraphStormGNNTrainingConfig, TuningStepConfigMixin):
    pass

so the config carries both the estimator fields (from the training config) and the search fields (from this mixin). TuningHandler reads these fields off b.config at build time; the search_space shape is converted to SDK ParameterRange objects by the handler’s _build_parameter_ranges (the SDK analog of Nexus’s launch_hpo.py _build_param_ranges).

class TuningStepConfigMixin(*, objective_metric_name, search_space, objective_type='Maximize', tuning_strategy='Bayesian', max_jobs=20, max_parallel_jobs=1, early_stopping_type='Off', metric_definitions=None)[source]

Bases: BaseModel

Search-axis fields for a hyperparameter-tuning step (the one behavior the Tuning verb adds).

Composed with a wrapped training config (multiple inheritance) so a tuning step’s single config supplies both the estimator inputs and the search configuration. Every field maps directly to a sagemaker.tuner.HyperparameterTuner constructor argument (SDK v2.x).

objective_metric_name: str

roc_auc”. Maps to HyperparameterTuner objective_metric_name.

Type:

The metric AMT optimizes, e.g. “val

Type:

is_abuse

search_space: Dict[str, List[Dict[str, Any]]]
The search space. Shape (mirrors Nexus launch_hpo.py _build_param_ranges):
{“continuous”: [{“name”: …, “min”: …, “max”: …, “scaling”: “Auto|Linear|Logarithmic|ReverseLogarithmic”}],

“integer”: [{“name”: …, “min”: …, “max”: …, “scaling”: …}], “categorical”: [{“name”: …, “values”: […]}]}

The handler’s _build_parameter_ranges converts each to a ContinuousParameter / IntegerParameter / CategoricalParameter.

objective_type: Literal['Maximize', 'Minimize']
tuning_strategy: Literal['Bayesian', 'Random', 'Hyperband', 'Grid']
max_jobs: int
max_parallel_jobs: int
early_stopping_type: Literal['Off', 'Auto']
metric_definitions: List[Dict[str, str]] | None

…}] scraped from the container’s stdout. REQUIRED when the wrapped compute is a byo_container (a custom image has no SDK-inferred metrics — the objective must be regex-scraped, exactly as Nexus launch_hpo.py does). Optional for a managed-DLC estimator whose metrics the SDK already knows.

Type:

Regex metric definitions [{“Name”

Type:

…, “Regex”

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].