nirs4all.pipeline.dagml.native_archive_replay module

Methods-only PREDICT replay from a validated Core Archive V2.

This is intentionally a composition boundary, not a second package or model reader: Core validates and returns the opaque Package V2 member; DAG-ML parses and validates the package and owns replay; the official pls4all binding imports N4MM only for the invocation. No legacy PipelineRunner is consulted.

class nirs4all.pipeline.dagml.native_archive_replay.NativeArchiveConformalInterval(coverage: float, lower: ndarray, upper: ndarray, qhat: float | ndarray, calibration_fingerprint: str)[source]

Bases: object

One finite native conformal interval view returned by DAG-ML replay.

The values are decoded from the exact interval block emitted by DAG-ML; this adapter neither calibrates nor recomputes endpoint arithmetic.

calibration_fingerprint: str
coverage: float
lower: ndarray
qhat: float | ndarray
upper: ndarray
class nirs4all.pipeline.dagml.native_archive_replay.NativeArchivePrediction(values: ndarray, sample_ids: tuple[str, ...], intervals: dict[float, NativeArchiveConformalInterval], conformal_guarantee_status: dict[str, Any] | None, conformal_presentation: dict[str, Any] | None = None)[source]

Bases: object

One identity-aligned native Archive V2 PREDICT result.

conformal_guarantee_status: dict[str, Any] | None
conformal_presentation: dict[str, Any] | None = None
intervals: dict[float, NativeArchiveConformalInterval]
sample_ids: tuple[str, ...]
values: ndarray
exception nirs4all.pipeline.dagml.native_archive_replay.NativeArchiveReplayError[source]

Bases: RuntimeError

The native Archive V2 → Methods PREDICT boundary could not be executed.

nirs4all.pipeline.dagml.native_archive_replay.predict_methods_archive_v2_raw(archive_path: str | Path, X: Any, *, sample_ids: Any, methods_library_path: str | Path | None = None, groups: Any = None, metadata: Any = None, outcome_id: str = 'outcome:nirs4all.archive_predict', run_id: str = 'run:nirs4all.archive_predict') → ndarray[source]

Predict a fresh raw-array cohort from a Core Archive V2 Methods package.

This is the first public composition that creates a current cohort replay request. It requires explicit stable identities, signs the request through DAG-ML and delegates N4MM import/prediction to pls4all. It never invokes a legacy pipeline or fabricates target content.

nirs4all.pipeline.dagml.native_archive_replay.predict_methods_archive_v2_raw_result(archive_path: str | Path, X: Any, *, sample_ids: Any, methods_library_path: str | Path | None = None, groups: Any = None, metadata: Any = None, outcome_id: str = 'outcome:nirs4all.archive_predict', run_id: str = 'run:nirs4all.archive_predict') → NativeArchivePrediction[source]

Replay a native archive and retain its exact conformal result blocks.

This is the public result-bearing form of predict_methods_archive_v2_raw(). It exposes only interval blocks already materialized and validated by DAG-ML; it never recalibrates.

nirs4all.pipeline.dagml.native_archive_replay.project_methods_archive_v2_conformal_presentation(archive_path: str | Path, X: Any, *, sample_ids: Any, methods_library_path: str | Path | None = None, groups: Any = None, metadata: Any = None, outcome_id: str = 'outcome:nirs4all.archive_conformal_presentation', run_id: str = 'run:nirs4all.archive_conformal_presentation') → dict[str, Any][source]

Project DAG-ML’s exact scalar conformal replay presentation.

This is a transport boundary: DAG-ML validates the Package V2 calibration, replay closure, quantiles, and interval arithmetic before producing the presentation. This adapter only verifies that the returned scalar view is the current prediction block and preserves its exact public identities. It intentionally does not recalibrate or reconstruct interval endpoints.

nirs4all.pipeline.dagml.native_archive_replay.replay_methods_archive_v2(archive_path: str | Path, request: Any, data_envelopes: Any, resolver: MaterializationResolver, *, outcome_id: str, run_id: str, fallback: Callable[[dict[str, Any]], dict[str, Any]] | None = None) → dict[str, Any][source]

Replay a portable Methods Package V2 stored in a Core Archive V2.

request and data_envelopes remain strict DAG-ML contracts supplied by the caller. In particular, a fresh target-free cohort is represented by a signed current envelope, never by a reused training relation or fabricated target hash. Archive contents are validated before this function sees any Package bytes; Package/replay validation runs before a host data callback.

nirs4all.pipeline.dagml.native_archive_replay.validate_methods_archive_v2(archive_path: str | Path) → None[source]

Preflight one Archive V2 without loading a Methods runtime or any cohort.

Core owns archive/container integrity and returns only the opaque Package member. DAG-ML then validates the Package V2 contract; this adapter adds the public raw-Methods closure check. Keeping that sequence at session open time ensures malformed archives fail before callers provide feature rows or native N4MM hydration is attempted.

nirs4all.pipeline.dagml.native_archive_replay.write_methods_archive_v2(archive_path: str | Path, *, archive_id: str, outcome: Any, package: Any) → dict[str, str][source]

Persist one native Methods Package V2 as a Core Archive V2.

DAG-ML alone assembles the closed manifest and the six companion members; Core alone validates and writes the ZIP. This boundary deliberately does not accept arbitrary members, retrofit host sidecars, or calculate member hashes in nirs4all.