You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ML-For-Beginners/Introduction/3-ethics
Jen Looper be77dee356
fairness lesson
5 years ago
..
translations renumbering all segments 5 years ago
README.md fairness lesson 5 years ago
assignment.md renumbering all segments 5 years ago

README.md

Fairness in Machine Learning

[Illustration “black box” here]

Pre-lecture quiz

Introduction

You are about to learn machine learning to make our lives better— your future systems and models may be going to be involved in the everyday decision-making, such as health care system or fraud detection. So, it is important that they work well in providing fair outcomes for everyone.

Imagine when the data you are using disproportionally represented, or lacks certain demographics, such as race, gender, political view, religion, etc. Or when the output is interpreted to favor some demographic. What is the consequence of the application?

In this lesson, you will:

  • Raise your awareness of importance of fairness in ML
  • Learn about fairness-related harms
  • Learn about unfairness assessment and mitigation

Prerequisite

As a prerequisite, please take the "Responsible AI Principles" Learn Path and watch the video below on the topic:

Learn more about Responsible AI by following this Learning Path

Microsoft's Approach to Responsible AI

Video: Microsoft's Approach to Responsible AI

Unfairness in data and algorithms

"If you torture the data long enough, it will confess to anything." - Ronald Coase

This sounds extreme but it is true that data can be manipulated to support any conclusion. And manipulation can happen unintentionally. As humans, we all have bias, and you just dont consciously know when you introduce bias in data. Fairness in AI and machine learning remains a complex sociotechnical challenge, meaning that it cannot be addressed from either purely social or technical perspectives.

Watch this video to learn about the fairness and socio-technical challenges:

![Responsible AI - Fairness

What do you mean by unfairness? —it is negative impacts for group of people, such as those defined in terms of race, gender, age, or disability status.
Main fairness-related harms can be classified as:

  • Allocation
  • Quality of service
  • Stereotyping
  • Denigration
  • Over- or under- representation

Lets take a look at the examples.

Example of Allocation

One of the examples is a system for screening loan applications. The system tends to pick white men as good candidates than other groups. As a result, loans are withheld from certain applicants.

Another example is this experimental hiring tool that developed by a large corporation to screen candidates. The tool systemically discriminated against women by using the models were trained to prefer masculine languages. It resulted in penalizing candidates whose resumes contain words such as “womens rugby team”.

Quality of service

Researchers found the three commercial gender classifiers had higher error rates that images of women with darker skin tones than the images of men with lighter skin tones.

Stereotyping

Stereotypical gender view was found in machine translation. When translating “he is a nurse and she is a doctor” into Turkish, a genderless language, which has one pronoun, “o” to convey a singular third person, then back into English yields the stereotypical and incorrect as “she is a nurse and he is a doctor”.

Denigration

An image labeling technology infamously mislabeled images of dark-skinned people as gorillas. Mislabeling is harmful not just because the system made a mistake because it specifically applied a label that has a long history of being purposefully used to denigrate demean Black people.

Over- or under- representation

Skewed image search results can be a good example of this harm. When searching images of professions with an equal or higher percentage of men than women, such as engineering, or CEO results heavily skewed toward images of men than reality.

There five main types of harms are not mutually exclusive, and a single system can exhibit more than one type of harms. Each case varies severities, for instance, unfairly labeling someone as a criminal is a much more severe harm than mislabeling an image but it's important to remember that even relatively non severe harms can make people feel alienated or singled out and the cumulative impact can be extremely oppressive.

Discussion: Revisit some of the examples and see if they show different harms.

Allocation Quality of service Stereotyping Denigration Over- or under- representation
Automated hiring system x x x x
Machine translation
Photo labeling

Detecting unfairness

There are many reasons why the system behaves unfairly— the reasons include societal biases reflected of the datasets used to train them. For example, the hiring unfairness was caused by the historical data, by using the patterns in resumes submitted to the company over a 10-year period, and the problem was that the majority came from men, a reflection of male dominance across the tech industry.

Inadequate data points about a certain group of people can be the reason. For example, image classifiers have higher rate error for images of dark-skinned women because there arent enough dataset with darker skin tones to train.

Wrong assumptions made during the development cases unfairness too. For example, facial analysis system to predict who is going to commit a crime based on images of peoples faces. The assumption to make it believe this system is capable of doing this could lead substantial harms for people who are misclassified.

Understand your models and build fairness

Although many aspects of fairness are not captured in quantitative fairness metrics, and it is not possible to fully remove bias from a system to guarantee fairness, you are still responsible to detect and to mitigate fairness issues as much as possible. When you are working with machine learning models, it is important to understand your models with interpretability and assess and mitigate unfairness. Lets use the loan selection example to isolate the case to figure out each factors level of impact on the prediction.

Assessment methods

  1. Identify the harms (and benefits)
  2. Identify the affected groups
  3. Define fairness metrics

Identify the harms (and benefits)

What are the harms and benefits associated with lending? Think false negatives and false positive scenarios: False negatives (reject, but Y=1) - when an applicant will be capable of repaying loan is rejected. This is an adverse event because the resources of the loans are withheld from qualified applicants. False positives (accept, but Y=0) - when the applicant does get the loan but eventually defaults. As the result, the applicant will be sent to the debt collection agencies, and possibly affects their future loan applications. Identify the affected groups

The next step is to determine which groups are likely to be affected. For example, in case of a credit card application, where you see women are receiving much lower credit limits compared with their spouses who shares assets, the affected groups can be defined by the gender identity.

Define fairness metrics

You have identified harms and affected groups, in this case, gender. Now, use the quantified factors to disaggregate metrics. For example, when you have the data below, by examining this table, we see the women has the largest false positive rate and men has the smallest, and the opposite for false negatives.

False positive rate False negative rate count
women 0.37 0.27 54032
men 0.31 0.35 28620
Non-binary 0.33 0.31 1266

Also, note that this table also tells us that the non-binary people have much smaller count. It means the data is less certain and possibly has a larger error bars, so you need to be more careful how you interpret these numbers.

So, in this case, we have 3 groups and 2 metrics. When we are thinking about how our system affects the group of customers/loan applicants, this may be sufficient, but when you want to define larger number of groups, you may want to distill this to smaller sets of summaries. To do that, you can add more metrics, such as largest difference, and smallest ratio of each false negative/positive rates.

Discussion: What other groups are likely to be affected for loan application?

Mitigating unfairness

To mitigate the fairness issue, explorer the model to generate various mitigated models and compare them navigate tradeoffs between accuracy and fairness to select the model with the desired trade off.

This intro lesson does not dive deeply into the details of algorithmic unfairness mitigation, such as post-processing and reductions approach, but introducing a tool that you may want to try.

Fairlearn

Fairlearn

The tool may help you to assesses how a model's predictions affect different groups, enables comparing multiple models by using fairness and performance metrics, and supply a set of algorithms to mitigate unfairness in binary classification and regression.

  • Learn how to use the different components by checking out the Fairlearn's GitHub, user guide, examples, and sample notebooks.

  • Learn how to enable fairness assessment of machine learning models in Azure Machine Learning.

  • See the sample notebooks for more fairness assessment scenarios in Azure Machine Learning.

🚀 Challenge

To avoid biases to be introduced in the first place, we should:

  • have a diversity of backgrounds and perspectives among the people working on systems
  • invest in datasets that reflect the diversity in our society
  • develop better methods for detecting and correcting bias when it occurs

What else should we consider?

Post-lecture quiz

Review & Self Study

In this lesson, you have learned about fairness/unfairness in ML.

Watch this workshop to dive deeper into the topics:

■ YouTube: Fairness-related harms in AI systems: Examples, assessment, and mitigation by Hanna Wallach and Miro Dudik Fairness-related harms in AI systems: Examples, assessment, and mitigation - YouTube

Also, read: ■ Microsofts RAI resource center: Responsible AI Resources Microsoft AI

■ Microsofts FATE research group: FATE: Fairness, Accountability, Transparency, and Ethics in AI - Microsoft Research

■ Fairlearn toolkit: Fairlearn

■ Azure Machine Learning - Machine learning fairness

https://docs.microsoft.com/en-us/azure/machine-learning/concept-fairness-ml

Assignment Name