nirs4all.pipeline.dagml.tuning_adapters module
Optimizer adapters for the native DAG-ML PipelineObjective.
P5 starts here: optimizers drive the same objective instead of embedding their
own evaluation logic. The Optuna adapter is functional for the portable subset
of the public tuning.space contract. The n4m adapter uses the native
ask/tell wrapper for the same objective where the wrapper exposes equivalent
search-space primitives.
- class nirs4all.pipeline.dagml.tuning_adapters.N4MPipelineObjectiveAdapter(optimizer_api: Any | None = None)[source]
Bases:
objectDrive a
PipelineObjectivewith the native n4m ask/tell optimizer.
- class nirs4all.pipeline.dagml.tuning_adapters.ObjectiveTuningRunResult(tuning_result: TuningResult, refit_estimator: Any | None, tuning_id: str | None = None)[source]
Bases:
objectInternal result for optimize-then-optional-refit over
PipelineObjective.- tuning_result: TuningResult
- class nirs4all.pipeline.dagml.tuning_adapters.OptunaPipelineObjectiveAdapter[source]
Bases:
objectDrive a
PipelineObjectivewith Optuna without duplicating scoring.
Bases:
NotImplementedErrorRaised when a requested optimizer adapter is not wired to P4 yet.
- nirs4all.pipeline.dagml.tuning_adapters.optimize_pipeline_objective(objective: PipelineObjective, X: Any, y: Any, *, sample_ids: Any = None, groups: Any = None, metadata: Any = None) TuningResult[source]
Dispatch the objective to the optimizer selected by its tuning spec.
- nirs4all.pipeline.dagml.tuning_adapters.run_pipeline_objective_tuning(objective: PipelineObjective, X: Any, y: Any, *, sample_ids: Any = None, groups: Any = None, metadata: Any = None, refit: bool = True, workspace_path: str | Path | None = None, workspace_name: str = '', workspace_tuning_id: str | None = None, workspace_metadata: Mapping[str, Any] | None = None, run_id: str | None = None, pipeline_id: str | None = None, chain_id: str | None = None) ObjectiveTuningRunResult[source]
Run optimizer-driving and the terminal winner refit as separate phases.
When
workspace_pathis provided, the completedTuningResultis persisted immediately after optimizer-driving and before terminal refit. That preserves the HPO evidence tape even if a later refit fails.