nirs4all.pipeline.dagml.run_backend module
Run a nirs4all pipeline on the dag-ml engine and return a RunResult (ADR-17 backend).
This is the operational seam for engine="dag-ml": it assembles the executable compat DSL,
drives dag-ml-cli through the nirs4all process adapter, and maps dag-ml’s native
bundle.scores — per-fold validation RMSE/R², the cross-fold OOF average (cv_best_score)
and the final-test score (best_rmse), all computed in Rust — into an in-memory
Predictions, wrapped in a RunResult.
The public API persists a workspace projection of the executed results. Supports the
vertical-slice shape (feature transforms + one model + an OOF/KFold-style splitter). Non-partition
CV (e.g. ShuffleSplit) is not yet supported by the dag-ml FoldSet (see migration notes).
The implementation is split across cohesive sibling modules — this module owns the entry point
(run_via_dagml()) and the path dispatch (_dispatch_run()); the detectors, dataset
materialization, exclude/tag resolution, fold construction, score mapping, and the per-shape
_run_* paths live in detect, dataset, exclude, folds,
result, and run_paths respectively. The names re-exported below keep the historical
nirs4all.pipeline.dagml.run_backend import surface stable.
- nirs4all.pipeline.dagml.run_backend.preflight_dagml_backend(cli: str, *, generated_views: bool = False) None[source]
Require a Python binding for generated views, or either static DAG mechanism.
Availability failure is reported to the caller before execution. It never changes the selected engine or retries with PipelineRunner.
- nirs4all.pipeline.dagml.run_backend.run_via_dagml(pipeline: Any, dataset: Any, *, name: str = '', random_state: int | None = None, refit: bool | dict[str, Any] | list[dict[str, Any]] | None = True, project: str | None = None, session: Any | None = None, cache: Any | None = None, runner_kwargs: dict[str, Any] | None = None, dagml_cli: str | Path | None = None, venv_python: str | None = None, workdir: str | Path | None = None, save_charts: bool = True, plots_visible: bool = False, results_path: str | Path | None = None, verbose: int = 0, save_artifacts: bool | None = None, report_naming: str = 'nirs', resolved_config_name: str | None = None) RunResult[source]
Execute a general pipeline and project its scored results.
The Rust in-process/CLI runtime is chosen by the execution router. The public API supplies save_artifacts=True by default: persist captured models under workspace/native_results and exact predictions in WorkspaceStore. False omits fitted model persistence; an explicitly requested workspace or project still receives metadata/arrays. None is the internal direct-call memory-only mode. An explicit results_path independently requests the verified native results format.
project tags the stored run; session retains the scored result and workspace without constructing PipelineRunner. verbose configures logging, and report_naming selects the existing NIRS/ML metric display labels. Remaining unsupported execution options are rejected before operators execute.