nirs4all.api.native_session module
Stateful native Methods session with no legacy workspace dependency.
- class nirs4all.api.native_session.NativeMethodsSession(pipeline: list[Any], *, name: str = '', random_state: int | None = None, tuning: Mapping[str, Any] | None = None, calibration: Mapping[str, Any] | None = None)[source]
Bases:
objectOne portable Methods pipeline through train, predict, export, and close.
This session holds only the fitted DAG-ML/Methods estimator and never creates a
PipelineRunneror legacy workspace. A persisted session is loaded throughnirs4all.load_session()withengine='native'and becomes aNativeArchiveSession.- property calibration: dict[str, Any] | None
Return the explicit identity-bound conformal calibration request.
- predict(X: Any, *, sample_ids: Any, groups: Any = None, metadata: Any = None) PredictResult[source]
Replay the fitted native package for one explicitly identified cohort.
- property random_state: int | None
The deterministic seed configured for every session training run.
- property result: NativeMethodsRunResult | NativeMethodsRefitResult
The fitted native run result, or raise before training.
- retrain(dataset: Mapping[str, Any]) NativeMethodsRefitResult[source]
Full-refit the attested selected Methods variant on one new cohort.
This delegates to the public native retrain contract, which preserves only the selected portable PLS recipe and its attested patch. Transfer learning and finetuning are intentionally not session capabilities.
- run(dataset: Mapping[str, Any]) NativeMethodsRunResult[source]
Fit this session’s portable Methods pipeline exactly once per call.