Preprocessing#

class preprocess.preprocess_object.PreProcessObject(seed=None, **kwargs)[source]#

Bases: ABC

Base class for a preprocessing step that transforms a dataset.

Steps are chained by Experiment (a typical pipeline is balance -> encode -> scale -> split -> finalize). A step receives a mutable DatasetObject, edits a snapshot() of its dataframe, and writes the result back with update(). A step that splits the data may return a tuple of datasets (e.g. train and test).

Parameters:

seed (int | None)

abstractmethod transform(input)[source]#

Apply the transformation to a dataset.

Parameters:

input (DatasetObject) – A mutable dataset to transform in place (or clone).

Returns:

The transformed dataset, or several datasets when the step splits the input (e.g. into trainset and testset).

Return type:

DatasetObject or tuple of DatasetObject