nirs4all.pipeline.dagml.pipeline_objective_compiler module
Narrow nirs4all pipeline compiler for the native tuning objective seam.
This is not the full public run(tuning=...) compiler. It accepts the
single-estimator and linear transformer→estimator shapes that the existing
PipelineObjective can execute honestly today, and rejects broader nirs4all
pipeline syntax fail-closed.
- class nirs4all.pipeline.dagml.pipeline_objective_compiler.CompiledPipelineObjective(objective: PipelineObjective, search_space: OrderedSearchSpaceSpec, X: Any, y: Any, sample_ids: Any = None, groups: Any = None, metadata: Any = None)[source]
Bases:
objectA compiled objective plus its aligned fit data.
- evaluate(params: Mapping[str, Any], *, trial_index: int = 0) PipelineObjectiveResult[source]
Evaluate one candidate against the compiled data payload.
- objective: PipelineObjective
- parameter_patches(params: Mapping[str, Any]) tuple[ParameterPatch, ...][source]
Return canonical ordered patches for one candidate mapping.
- run_tuning(**kwargs: Any) Any[source]
Run optimizer-driving over the compiled objective.
Keyword arguments are forwarded to
nirs4all.pipeline.dagml.tuning_adapters.run_pipeline_objective_tuning()for internal orchestration options such asrefitorworkspace_path.
- search_space: OrderedSearchSpaceSpec
- nirs4all.pipeline.dagml.pipeline_objective_compiler.compile_pipeline_objective(pipeline: Any, X: Any, y: Any, tuning: DagMLTuningSpec | Mapping[str, Any], *, score_extractor: Callable[[Any], float], sample_ids: Any = None, groups: Any = None, metadata: Any = None, clone_estimator: bool = True) CompiledPipelineObjective[source]
Compile the currently supported nirs4all shape into
PipelineObjective.Supported input forms are:
an estimator instance with
fit;[estimator];[{"model": estimator}]or{"model": estimator}.{"steps": [...]}or{"pipeline": [...]}for the same supported step sequence;a linear sequence of transformer instances followed by one estimator;
transformer mapping steps
{"transform": transformer, "name": "..."}followed by{"model": estimator};explicit
"sklearn.module.Class"string steps without constructor parameters.
Splitters, branches, string model aliases,
finetune_paramsand arbitrary step keywords remain outside this seam and raise explicit errors.
- nirs4all.pipeline.dagml.pipeline_objective_compiler.run_single_estimator_tuning_to_run_result(pipeline: Any, X: Any, y: Any, tuning: DagMLTuningSpec | Mapping[str, Any], *, score_extractor: Callable[[Any], float], sample_ids: Any = None, groups: Any = None, metadata: Any = None, clone_estimator: bool = True, 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, resume_tuning_result: Any | None = None, resume_tuning_id: str | None = None, per_dataset: Mapping[str, Any] | None = None, winner_x: Any | None = None, winner_y_true: Any | None = None, winner_score: float | None = None, winner_metric: str | None = None, winner_sample_ids: Sequence[Any] | None = None, winner_dataset_name: str = 'tuning_winner', winner_model_name: str | None = None, winner_task_type: str = 'regression', winner_metadata: Mapping[str, Any] | None = None) RunResult[source]
Run the narrow single-estimator tuning lane and return a
RunResult.This helper stitches together the current internal seams:
compile_pipeline_objective()→ optimizer/refit orchestration →project_objective_tuning_to_run_result(). It remains deliberately narrower than publicrun(tuning=...)and inherits the projection rule that winner predictions require explicit caller-provided score evidence.