Recipe#

class sdm.processing.recipe.Recipe(features: Processor | Iterable[Processor] | None = None, target: Processor | Iterable[Processor] | None = None, output: Processor | Iterable[Processor] | None = None)#

Bases: object

Processing contract around an external model boundary.

A recipe bundles three processing pipelines, one per role the data plays relative to the model:

  • features: model inputs, transformed before the model.

  • target: labels transformed forward before the model. Regression predictions are inverted through this pipeline; classification outputs are reconstructed from the fitted target categories instead.

  • output: transforms member outputs after they have been mapped to a common class or target space and stacked as [E, ..., R, O]. An explicit dimension-changing step such as AverageEstimators removes E; without one, the output remains stacked. Steps before the reducer must support stacked outputs, while steps after it receive already-reduced outputs.

Each pipeline exposes fit/transform/fit_transform and, when its steps are invertible, inverse_transform. Call them directly, e.g. recipe.features.transform(table) or recipe.target.inverse_transform(prediction). Recipes do not infer each step’s non-finite input contract; order steps so values are imputed before processors that do not explicitly document non-finite support.

Parameters:
  • features (Processor | Iterable[Processor] | None) – Steps applied to model inputs before model execution.

  • target (Processor | Iterable[Processor] | None) – Steps applied to labels before model execution.

  • output (Processor | Iterable[Processor] | None) – Steps applied to stacked model outputs.

property features: EnsembleProcessor#

The steps applied to model inputs.

property target: EnsembleProcessor#

The steps applied to labels.

property output: EnsembleProcessor#

The steps applied to model outputs.

prepend_features(processor: object) → Self#

Prepend a processor to the feature pipeline.

Parameters:

processor (object)

Return type:

Self

append_features(processor: object) → Self#

Append a processor to the feature pipeline.

Parameters:

processor (object)

Return type:

Self

prepend_target(processor: object) → Self#

Prepend a processor to the target pipeline.

Parameters:

processor (object)

Return type:

Self

append_target(processor: object) → Self#

Append a processor to the target pipeline.

Parameters:

processor (object)

Return type:

Self

prepend_output(processor: object) → Self#

Prepend a processor to the output pipeline.

Parameters:

processor (object)

Return type:

Self

append_output(processor: object) → Self#

Append a processor to the output pipeline.

Parameters:

processor (object)

Return type:

Self