nirs4all.api.native_archive_training module

Callback-free Methods training that closes directly into Core Archive V2.

This module accepts explicit raw arrays, one KFold-like splitter and one sklearn PLSRegression declaration. The explicit PLS RolePipeline profile also runs independent native searches within the declared outer folds and at final REFIT. Single- and multi-target regression are supported when target identities are explicit. DAG-ML owns scheduling and archive-member assembly, Methods owns fit/predict and portable RAW bytes, and Core alone writes and validates the .n4a container.

exception nirs4all.api.native_archive_training.NativeArchiveTrainingError[source]

Bases: RuntimeError

The installed native stack cannot produce a portable Archive V2.

class nirs4all.api.native_archive_training.NativeMethodsArchiveRunResult(projected: RunResult, *, dag_ml: Any, core: Any, training_result: Any, outcome: Mapping[str, Any], package: Mapping[str, Any], outcome_contract: Any, package_contract: Any, package_json: str, archive_id: str, methods_library_path: str, pipeline: list[Any])[source]

Bases: RunResult

A normal score projection retaining only portable Methods contracts.

close() → None[source]

Release native handles while retaining immutable package/archive bytes.

export(output_path: str | Path, format: str = 'n4a', source: dict[str, Any] | None = None, chain_id: str | None = None, *, compatibility: str | None = None) → Path[source]

Write the captured Package V2/N4MM without refitting or host models.

property native_archive_reference: dict[str, str] | None

Return the Core-issued id/checksum of the last successful save.

property native_execution_is_live: bool

Whether the native training resources have not yet been detached.

property tuning_best_params: dict[str, Any]

Return the DAG-selected native Methods parameters without Python HPO.

property tuning_best_value: float | None

Return native HPO’s best score; fold mode reports REFIT inner OOF.

property tuning_resume_package: dict[str, Any] | None

Return the immutable Package V2 snapshot accepted for HPO resume.

property tuning_scope_results: dict[str, Any]

Return outer/REFIT native study evidence as an independent snapshot.

Empty for campaign HPO. The REFIT inner score differs from the public outer-CV score; effective saved parameters can include refit overrides.

exception nirs4all.api.native_archive_training.NativeMethodsHpoCapabilityError[source]

Bases: NativeArchiveTrainingError, ValueError

The public HPO request exceeds the selected portable Methods slice.

nirs4all.api.native_archive_training.run_native_methods_archive(pipeline: Any, dataset: Any, *, name: str = '', verbose: int = 1, save_artifacts: bool = True, save_charts: bool = False, plots_visible: bool = False, random_state: int | None = None, refit: Any = True, cache: Any = None, project: str | None = None, report_naming: str = 'nirs', results_path: Any = None, session: Any = None, runner_kwargs: Mapping[str, Any] | None = None, native_profile: str | None = None) → NativeMethodsArchiveRunResult[source]

Run the frozen portable Methods subset without PipelineRunner.