AI Ethics and Governance Intermediate 13 minutes

Bias Mitigation Techniques

Intervening before, during and after training, and when the solution lies outside the model altogether.

Your progress in the track0%

Three families

FamilyExamplesAdvantageDrawback
Pre-processingReweighting, resampling, improving labelsIndependent of the modelMay not be enough
In-processingConstraints in optimization, adversarial trainingFiner controlRequires retraining
Post-processingThresholds by groupFastNeeds 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

  1. Is the label itself biased? (the lesson on sources of bias)
  2. Can more representative data be collected?
  3. Does the way the decision is used amplify the harm?
  4. 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

  1. What is the advantage of post-processing intervention?

    It does not require retraining, and it can be applied to an existing model.

  2. 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

  1. Fairlearn — Mitigation
  2. Agarwal et al. (2018) — A Reductions Approach to Fair Classification
  3. Hardt, Price & Srebro (2016) — Equality of Opportunity in Supervised Learning
  4. AI Fairness 360

Complete the lesson