Bias Mitigation Techniques
Intervening before, during and after training, and when the solution lies outside the model altogether.
Three families
| Family | Examples | Advantage | Drawback |
|---|---|---|---|
| Pre-processing | Reweighting, resampling, improving labels | Independent of the model | May not be enough |
| In-processing | Constraints in optimization, adversarial training | Finer control | Requires retraining |
| Post-processing | Thresholds by group | Fast | Needs the sensitive attribute at decision time |
In-processing with Fairlearn
from fairlearn.reductions import ExponentiatedGradient, EqualizedOdds
from sklearn.linear_model import LogisticRegression
mitigator = ExponentiatedGradient(LogisticRegression(max_iter=1000), constraints=EqualizedOdds())
mitigator.fit(X_train, y_train, sensitive_features=group_train)
y_pred = mitigator.predict(X_test)Post-processing
from fairlearn.postprocessing import ThresholdOptimizer
to = ThresholdOptimizer(estimator=base_model, constraints="true_positive_rate_parity",
predict_method="predict_proba", prefit=True)
to.fit(X_val, y_val, sensitive_features=group_val)
y_pred = to.predict(X_test, sensitive_features=group_test, random_state=0)Before you turn to algorithms
- Is the label itself biased? (the lesson on sources of bias)
- Can more representative data be collected?
- Does the way the decision is used amplify the harm?
- Should this decision be automated at all?
Evaluation
- Compare performance and fairness before and after the intervention on independent test data.
- Plot the trade-off curve between performance and the fairness metric.
- Involve stakeholders in choosing the balance point.
Whether it is lawful to use the sensitive attribute in training or in the decision differs between countries and sectors; check the applicable legal framework.
Lesson terms
- Reweighing
- Adjusting the weights of training examples so that the sensitive attribute and the label become statistically independent in the weighted data.
- Group-specific threshold optimization
- Choosing a different decision threshold for each group to achieve a specific fairness metric after training.
Abstract
Bias mitigation methods fall into three families: pre-processing (reweighting or resampling, and improving data collection and the definition of the target), in-processing (fairness constraints in optimization, such as the exponentiated gradient reduction), and post-processing (different thresholds for each group to achieve a specific metric). Every intervention has a cost on other metrics and must be evaluated on independent data. Sometimes the best solution lies outside the model: a better target definition, collecting representative data, or changing how the decision is used.
Review questions
-
What is the advantage of post-processing intervention?
It does not require retraining, and it can be applied to an existing model.
-
What is the possible problem with using different thresholds for each group?
It requires using the sensitive attribute at decision time, which may be legally prohibited in some contexts.
Sources and references
Complete the lesson
You have completed all the lessons in the track! You can now request the track completion certificate.
Request the certificate