nirs4all.api.native_training module
Explicit public entry point for the first fully-native training lane.
The broad nirs4all.run() compatibility surface still contains legacy
workflow features that are not expressible by the portable runtime. This
module deliberately exposes only the proven raw-array lane instead of silently
re-running that workflow through PipelineRunner during export.
- nirs4all.api.native_training.fit_native_pipeline(pipeline: list[Any], X: Any, y: Any, *, sample_ids: Sequence[str], groups: Sequence[Any] | None = None, metadata: Mapping[str, Sequence[Any]] | None = None, selection_metric: str = 'rmse', selection_objective: str = 'minimize', package_id: str | None = None, dagml_module: str = 'dag_ml', native_client: Any = None, training_losses: tuple[Mapping[str, Any], ...] = (), local_implementations: Any = None, methods_library_path: str | None = None, methods_hpo_operation: Mapping[str, Any] | None = None, seed: int = 12345, retrain_lineage: NativeRetrainLineage | None = None) DagMLPipelineEstimator[source]
Fit the supported raw-array pipeline entirely through DAG-ML.
This is an intentionally narrow native API: either one KFold/PLS model or an exact nested-OOF stack of two-or-more PLS branches followed by default sklearn
Ridge(alpha=...). The Ridge features are scheduler-owned OOF predictions; the raw matrix is retained only for identity/target attestation. Inputs remain finite 2-DXwith finite targets.sample_idsare mandatory because the resulting Package V2 and Archive V2 require stable identities for every later PREDICT cohort.The installed DAG-ML runtime must produce a
portable_requiredMethods Package V2 with one durable N4MM refit artifact. Host-sidecar/joblib results are refused before this function returns: they cannot be replayed or exported as a native archive. A successful estimator retains the exact nativeTrainingResult,TrainingOutcomeand Package V2. Itsexport_native_archive()method writes Archive V2 directly; it never invokes the legacy runner or fits the model a second time. Withnirs4all[native], the bundlednirs4all-methodsruntime is discovered automatically;methods_library_pathremains an explicit deployment override.
- nirs4all.api.native_training.run_native_methods(pipeline: list[Any], dataset: Mapping[str, Any], *, name: str = '', session: Any = None, save_artifacts: bool = True, save_charts: bool = False, plots_visible: bool = False, random_state: int | None = None, refit: bool | None = True, cache: Any = None, project: str | None = None, report_naming: str = 'nirs', results_path: Any = None, runner_kwargs: Mapping[str, Any] | None = None, tuning: Any = None, calibration: Any = None, terminal_predict: Mapping[str, Any] | None = None, retrain_lineage: NativeRetrainLineage | None = None) NativeMethodsRunResult[source]
Run the verified public Methods training subset without a legacy runner.
The accepted dataset is exactly
{X, y, sample_ids}with optionalgroupsandmetadata. Charts, workspaces, sessions, cache, tuning, and non-native refit policies remain explicit capability refusals rather than becoming ignored legacy arguments.tuningis deliberately a separate, strict native operation rather than the older Python objective adapter. Its V1 shape is{"engine": "methods-hpo", "trials": N}, optionally selecting the attestedrandom/tpesampler andnone/medianpruner. A later call may addresume_package_jsonobtained fromNativeMethodsRunResult.hpo_resume_package_json(); it is the complete signed package, never a caller-provided checkpoint. DAG-ML owns all trial execution, resume validation, SELECT, native incumbent attestation, and the single selected rerun/refit.