identify_pipeline = IdentifyBiasSources(nr_groups=20, # nr of segments based on using unsupervised learning to group similar rows
train_model_segment=True,
group_def=['unsupervised'],
fit_metrics=[accuracy, equal_opportunity])
# the DebiasPipeline aims to mitigate sources of bias by applying different types of repair algorithms
# the library offers implementations of repair algorithms described in the academic fairness literature
repair_pipeline = RepairResamplePipeline(steps=[ResampleUnbiasedSegmentsStep(ratio_resample=1)], random_seed=4)
debias_pipeline = DebiasPipeline(data_pipeline=pipeline_initial,
identify_pipeline=identify_pipeline,
repair_pipeline=repair_pipeline)