Preprocessors#

Base preprocessors#

class udao.data.preprocessors.base_preprocessor.StaticPreprocessor#

Bases: ABC, Generic[T]

Base class for feature processors that do not require training.

class udao.data.preprocessors.base_preprocessor.TrainedPreprocessor#

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: TrainedPreprocessor[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.

inverse_transform(container: T) T#

Reverse the normalization process on the container’s data.

Parameters:

container (T) – Child of BaseContainer with the normalized data.

Returns:

Child of BaseContainer with the data in original scale.

Return type:

T

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