aws / amazon-sagemaker-examples

Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
https://sagemaker-examples.readthedocs.io
Apache License 2.0
10.14k stars 6.78k forks source link

Bias mitigation and fairness boosting in multi class classification use case using Amazon SageMaker Clarify #3779

Open pradeepdev-1995 opened 1 year ago

pradeepdev-1995 commented 1 year ago

Is Amazon SageMaker Clarify support mitigating bias and improving fairness in multi class classification problems? If so please provide an example for doing the same in a sample multi class classification dataset.

xgchena commented 1 year ago

Thank you for reaching out to us.

In this context I guess you want to use SageMaker Clarify processing job for bias analysis. Currently the job supports detecting potential bias during data preparation (pre-training) and in trained model (post-training), but it does not support bias mitigation methods yet.

To detect bias for multi-class classification problems: when you configure the Clarify job for bias analysis, there is a parameter called label_values_or_threshold. If the label is multi-class, the parameter should be a list of label values that are favorable to a demographic group observed in a sample.

E.g., if the label column of your dataset has three classes "A", "B" and "C", and samples that have label value "A" or "B" designates positive result, then assign ["A", "B"] to the parameter,

FYI: SageMaker Clarify uses these terms to discuss bias and fairness, and here are the definition of pretraining bias metrics and posttraining bias metrics.

If you have any additional questions regarding the topic, we suggest that you post your queries to the AWS re:Post forum. It is a great platform to get support from the community and our experts. Please remember to include the tag Amazon SageMaker Clarify in your post to help us better understand your query and provide you with the most relevant assistance. We hope this helps and look forward to hearing from you on the forum.