Source code for fair_forge.preprocessing.definitions
fromtypingimportAny,Protocol,Selfimportnumpyasnpfromnumpy.typingimportNDArrayfromsklearn.utils.metadata_routingimportMetadataRequest__all__=["GroupBasedTransform","GroupDatasetModifier","Preprocessor"]class_PreprocessorBase(Protocol):"""A protocol for preprocessing methods."""defget_params(self,deep:bool=...)->dict[str,object]:...defset_params(self,**kwargs:Any)->Self:...defget_metadata_routing(self)->MetadataRequest:...
[docs]classGroupDatasetModifier(_PreprocessorBase,Protocol):"""A transformation which modifies both the dataset and the labels based on group information."""
[docs]deffit(self,X:NDArray[np.float32],y:NDArray[np.int32],*,groups:NDArray[np.int32])->Self:"""Fit the preprocessing method to the data with group information."""...