nirs4all.api.native_refit_result module

Public, scoreless result of one fresh native Methods full refit.

Package V3 deliberately records a new REFIT artifact rather than copying the parent CV/SELECT score set. This result therefore exposes identity-bound PREDICT replay and its durable child package, but never invents a new cross-validation score or a legacy workspace projection.

class nirs4all.api.native_refit_result.NativeMethodsRefitResult(package: Any, *, methods_library_path: str | None, dagml_module: str, decoder: Callable[[Any, Any], ndarray])[source]

Bases: object

A detached V3 child with explicit-identity native prediction only.

export(output_path: str | Path, *, archive_id: str | None = None, core_module: str = 'nirs4all_core', **kwargs: Any) → Path[source]

Write a strict native Package V3 Core container without any legacy bundle fallback.

Core builds the standalone refit closure from this child package through DAG-ML and writes the new container (no parent outcome, RefitOf link or score is invented). The destination must not exist: Core never replaces a file. The optional archive_id is the Core container id; a deterministic, portable identifier is used when it is omitted.

classmethod from_package_json(package_json: str, *, methods_library_path: str | None = None, dagml_module: str = 'dag_ml', decoder: Callable[[Any, Any], ndarray] | None = None) → NativeMethodsRefitResult[source]

Load and strictly validate a detached V3 package JSON payload.

classmethod load_archive(path: str | Path, *, methods_library_path: str | None = None, dagml_module: str = 'dag_ml', decoder: Callable[[Any, Any], ndarray] | None = None, core_module: str = 'nirs4all_core', source: Any = None) → NativeMethodsRefitResult[source]

Load a Core-validated native Package V3 container, then strictly parse Package V3.

source is the caller’s retained N4aSource; Core then reads through its one verified handle instead of reopening path.

classmethod load_package(path: str | Path, *, methods_library_path: str | None = None, dagml_module: str = 'dag_ml', decoder: Callable[[Any, Any], ndarray] | None = None) → NativeMethodsRefitResult[source]

Load one explicit Package V3 JSON file for native PREDICT replay.

property package: Any

The exact DAG-ML Package V3 child returned by native REFIT.

package_json() → str[source]

Return the strict, self-fingerprinted Package V3 JSON payload.

predict(X: Any, *, sample_ids: Any, groups: Any = None, metadata: Any = None) → PredictResult[source]

Run scheduler-owned PREDICT from a V3 native Methods child.

Native N4MM/N4ME states and the closed native PLS RolePipeline retain their original controller identities, with no host model conversion.

sample_ids are mandatory. No positional IDs, source estimator, Python model or host-sidecar is used by this operation.

save_package(path: str | Path) → Path[source]

Persist the signed V3 package without invoking a legacy exporter.

This is intentionally a Package V3 JSON file, not a native Package V3 container (export()). Core remains the owner of containers and their publication policy. Existing paths are refused and a failed write is removed, so callers never receive a partially written replacement.