
Last chance! 50% off unlimited learning
Sale ends in
Function aggregates all pre-processing algorithms for bias mitigation. User passes unified arguments and specifies type to receive transformed data.frame
pre_process_data(data, protected, y, type = "resample_uniform", ...)
modified data (data.frame
). In case of type = 'reweight' data has feature `_weights_` containing weights that need to be passed to model.
In other cases data is ready to be passed as training data to a model.
data.frame
factor, protected attribute (sensitive variable) containing information about gender, race etc...
numeric, numeric values of predicted variable. 1 should denote favorable outcome.
character, type of pre-processing algorithm to be used, one of:
resample_uniform
resample_preferential
reweight
disparate_impact_remover
other parameters passed to pre-processing algorithms
data("german")
pre_process_data(german,
german$Sex,
as.numeric(german$Risk) - 1,
type = "disparate_impact_remover",
features_to_transform = "Age"
)
Run the code above in your browser using DataLab