nirs4all.pipeline.dagml.target_capture module

Target-output transforms attached only to captured host artifacts.

Training and native scoring operate in the model’s declared numeric target space. Exported predictors additionally need to restore the labels supplied by the user. Keeping that decoder outside the runtime y_processing transform prevents decoded labels from leaking back into DAG score blocks.

class nirs4all.pipeline.dagml.target_capture.CapturedTargetTransform(transformer: Any, decoder: Any)[source]

Bases: TransformerMixin, BaseEstimator

Compose an optional model-target transform with a fitted label decoder.

property classes_: Any

Expose the captured public class axis when the decoder has one.

decode(y: Any) → Any[source]

Decode numeric targets to the labels supplied by the user.

fit(y: Any, *_args: Any, **_kwargs: Any) → CapturedTargetTransform[source]
fit_transform(y: Any, *_args: Any, **_kwargs: Any) → Any[source]

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Input samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) – Target values (None for unsupervised transformations).

  • **fit_params (dict) – Additional fit parameters. Pass only if the estimator accepts additional params in its fit method.

Returns:

X_new – Transformed array.

Return type:

ndarray array of shape (n_samples, n_features_new)

inverse_numeric(y: Any) → Any[source]

Restore numeric target space without decoding labels.

inverse_transform(y: Any) → Any[source]
transform(y: Any) → Any[source]
nirs4all.pipeline.dagml.target_capture.captured_target_transform(transformer: Any, decoder: Any, estimator: Any) → Any[source]

Attach public label decoding only to estimators that emit class indices.

nirs4all.pipeline.dagml.target_capture.has_categorical_target_output(transformer: Any) → bool[source]

Recognize owner-defined ordinal binning, including composed target chains.

nirs4all.pipeline.dagml.target_capture.pipeline_task_type(pipeline: list[Any], fallback: str) → str[source]

Resolve a homogeneous model task without mutating dataset targets.

Public successive checkpoints are dispatched separately before this point. A single native graph has one task and cannot silently mix model tasks.

nirs4all.pipeline.dagml.target_capture.validate_classification_target_domains(pipeline: list[Any], *, refit: bool = True, refit_top_k: int = 1) → None[source]

Refuse pooled CV when learned bin maps can change class meaning by fold.

One full-training fit has one domain and remains supported. Fixed explicit cut points also define one domain across CV folds. Learned fold maps require a native target-domain-aware selection/aggregation contract.