DataProcessing

class raimitigations.dataprocessing.DataProcessing(verbose: bool = True)

Base class for all classes present in the dataprocessing module of the RAIMitigation library. Implements basic functionalities that can be used throughout different mitigations.

Parameters

verbose – indicates whether internal messages should be printed or not.

inverse_transform(df: DataFrame)

Implements the behavior for the inverse transformation. This method first checks if the current class can be reversed. All transformation classes that can be reversed have a private _inverse_transform() method. If the current class doesn’t have this method, an error is raised. If it does, then we call this method. The next step is to reverse all other reversible transformations in the transf_pipe parameter up until we reach the first reversible transformation. The following steps are executed: (i) call the _inverse_transform() method for the current class, which returns a new dataset, (ii) call the _inverse_transform() method for all other transformers in the transform_pipe parameter (note that these methods are called in reverse order to guarantee a correct behavior, and that the inverse_transform is called only for the transformations that appear after the last non-reversible transformer object in the transform_pipe parameter), (iii) return the reversed dataset.

Parameters

df – the dataframe to be scaled containing all original columns, that is, all columns that should be ignored and those that should be scaled.

Returns

the dataset df after calling the _inverse_transform() method of all objects in the self.transform_pipe internal parameter (in reversed order).

Return type

pd.DataFrame or np.ndarray

The following is a list of all child classes that inherit from the DataProcessing class:

Class Diagram

Inheritance diagram of raimitigations.dataprocessing.DataEncoding, raimitigations.dataprocessing.FeatureSelection, raimitigations.dataprocessing.DataImputer, raimitigations.dataprocessing.DataScaler, raimitigations.dataprocessing.Rebalance, raimitigations.dataprocessing.Synthesizer, raimitigations.cohort.CohortHandler