Preprocessors

Base preprocessors

class udao.data.preprocessors.base_preprocessor.StaticFeaturePreprocessor

Bases: ABC, Generic[T]

Base class for feature processors that do not require training.

class udao.data.preprocessors.base_preprocessor.TrainedFeaturePreprocessor

Bases: ABC, Generic[T]

Base class for feature processors that require training.

Normalize preprocessor

class udao.data.preprocessors.normalize_preprocessor.FitTransformProtocol(*args, **kwargs)

Bases: Protocol

class udao.data.preprocessors.normalize_preprocessor.NormalizePreprocessor(normalizer: FitTransformProtocol, data_key: str = 'data')

Bases: TrainedFeaturePreprocessor[T]

Normalize the data using a normalizer that implements the fit and transform methods, e.g. MinMaxScaler.

Parameters:
  • normalizer (FitTransformProtocol) – A normalizer that implements the fit and transform methods (e.g. sklearn.MinMaxScaler)

  • df_key (str) – The key of the dataframe in the container.

preprocess(container: T, split: Literal['train', 'val', 'test']) T

Normalize the data in the container.

Parameters:
  • container (T) – Child of BaseContainer

  • split (DatasetType) – Train or other (val, test).

Returns:

Child of BaseContainer with the normalized data.

Return type:

T