Processor#
- class sdm.processing.base.Processor#
-
Base processor for tensor-aware table transformations.
A
Processordefines a reusable transformation onTableTensorfor feature, target and output preprocessing. AProcessorlearns any required state viafit(), and applies the transformation viatransform(). Implementations preserve batch dimensions, and preserve rows unless documented otherwise. Batch dimensions are processed independently.fit(),transform(), andfit_transform()are no-ops for stypes outside ofhandles_stypes.- static as_processor(processor: object) Processor#
Normalize a processor-like object to a
Processor.- Parameters:
processor (object) – A processor-like object. A
Processoris returned as-is, a callable is wrapped as a stateless processor, and a sequence of processor-like objects is normalized toSequential.- Return type:
- fit(table: TableTensor, *, generator: Generator | None = None) Self#
Fit the processor.
- Parameters:
table (TableTensor) – The table used to compute the processor state.
generator (Generator | None) – Pseudorandom number generator used for sampling.
- Return type:
- transform(table: TableTensor) TableTensor#
Transform
table.- Parameters:
table (TableTensor) – The table to transform.
- Returns:
The transformed table.
- Return type:
- forward(table: TableTensor) TableTensor#
Alias of
transform().- Parameters:
table (TableTensor)
- Return type:
- fit_transform(table: TableTensor, *, generator: Generator | None = None) TableTensor#
Fit the processor and transform
table.- Parameters:
table (TableTensor) – The table to fit on and transform.
generator (Generator | None) – Pseudorandom number generator used for sampling.
- Returns:
The transformed table.
- Return type: