Skip to main content
The Importance of Model Fairness and
Interpretability in AI Systems
Spark Summit 2020
Machine Fairness
How to assess AI system’s fairness and mitigate any observed unfairness issues
www.aka.ms/Fairlearn-build2020
Resources
➢www.aka.ms/InterpretML-github
➢www.aka.ms/InterpretML-toolkit
➢www.aka.ms/InterpretML-doc
➢www.aka.ms/FairlearnAI
➢www.aka.ms/FairlearnAIDoc
➢www.aka.ms/ResponsibleMLDoc
➢www.aka.ms/AzureResponsibleML
➢www.aka.ms/AzureMLDoc
➢www.aka.ms/AzureMLservice
Agenda
WHY RESPONSIBLE AI?
INTERPRETML
FAIRLEARN TOOLKIT
AI will have a considerable impact on
business and society as a whole
Report
Why Responsible AI?
Microsoft’s AI Principles
Microsoft’s AI Principles
Transparency
AI systems should be explainable
AI systems should have algorithmic
accountability
Machine Learning Interpretability use cases
www.aka.ms/InterpretML-github
Interpretability Toolkit
www.aka.ms/InterpretML-github
Explain Models - www.aka.ms/InterpretML-toolkit
InterpretML Repo - www.aka.ms/InterpretML-github
Interpret
Tabular Data
Additional interpretability
techniques for tabular
extension
www.aka.ms/InterpretML-github github/InterpretML/Interpret-Community
Interpret-
Community
Interpret
Tabular Data
Additional interpretability
techniques for tabular
extension
github/InterpretML/Interpret github/InterpretML/Interpret-Community
Interpret-
Community
AzureML-
Interpret
wrapper
Azure Machine Learning SDK
InterpretML Repo - www.aka.ms/InterpretML-github
Interpret
Tabular Data
Additional interpretability
techniques for tabular
extension
github/InterpretML/Interpret github/InterpretML/Interpret-Community
Interpret-
Community
Interpret-
text-contrib
github/InterpretML/Interpret-text-contrib
Text Data
(Text Classification)
AzureML-
Interpret
wrapper
Azure Machine Learning SDK
InterpretML Repo - www.aka.ms/InterpretML-github
Types of
Models
supported
www.aka.ms/InterpretML-github
Interpretability Approaches
• Given an existing model/system, extract
explanations
• Typically provide approximate explanations
• Examples: LIME, SHAP, Permutation Feature
Importance, Sensitivity Analysis, Influence
Functions, etc.
Tools to explain the system
www.aka.ms/InterpretML-github
SHAP
(SHapley Additive
exPlanations)
• Not a new concept
• Concept based on game theory
• Mathematically sound
• Application in ML relatively new
www.aka.ms/InterpretML-github
SHAP
Modeling scenario:
House pricing
prediction
www.aka.ms/InterpretML-github
How much has each feature contributed
to the prediction compared to the average prediction?
House price
prediction:
€ 300,000
Average house
price prediction
for all apartments
is € 310,000
Delta here is
- €10,000
www.aka.ms/InterpretML-github
Parks contributed
+10k
Cats banned
contributed -50k
50𝑚2
contributed
+10k 2nd floor had net zero
contributions
www.aka.ms/InterpretML-github
SHAP
How do we calculate Shapley values?
• Take your feature of interest (e.g.,
cats-banned) and remove it from the
feature set
• Take the remaining features and
generate all possible coalitions
• Add and remove your feature of
interested to each of the coalitions
and calculate the difference it makes
www.aka.ms/InterpretML-github
SHAP Pros SHAP Cons
Based on a solid theory and distributes the
effects fairly
Computation time: 2k possible coalitions of the
feature values for k features
Contrastive explanations: Instead of comparing a
prediction to the average prediction of the entire
dataset, you could compare it to a subset or even
to a single data point.
Can be misinterpreted
Inclusion of unrealistic data instances when
features are correlated.
www.aka.ms/InterpretML-github
Interpretability Approaches
• Models inherently interpretable
• Typically provide exact explanations
• Examples: Linear Models, Decision Rule Lists,
Explainable Boosting Machines, Shallow
Decision Trees, etc.
Tools to explain the system
www.aka.ms/InterpretML-github
Linear Models
• (Generalized) Linear Models
• Current standard for interpretable
models
• Learns an additive relationship
between data and response:
• y = β0 + β1x1 + β2x2 + ... + βn xn
• βi terms are scalar – single number
that multiplies to each feature value
• Each feature contributes a “score”
that adds up to final output
Example Model :
House Price = 50,000 + 0.2*sq_ft +
10000*bedrooms +
7000*bathrooms
Using this model on a new house:
- 5 Bedrooms
- 3 Bathrooms
- 3000 Sq Feet
- House Price = 50000 + 0.2*3000
+ 10000*5 + 7000 * 3
- House Price = $121,600
www.aka.ms/InterpretML-github
Explainable Boosting Machine
• Generalized Additive Models (with Pairwise
Interactions)
• GAMs have existed since 1980s
• MSR invented new methods of training GAMs for
higher accuracy
• Think of it as a “more expressive” linear model
• Still additive!
• Linear Model: y = β0 + β1x1 + β2x2 + ... + βn xn
• Additive Model: y = f1(x1) + f2(x2) + ... + fn (xn)
• Additive Model with Pairwise Interactions
(EBM):
y = Ʃi fi (xi) + Ʃij fij (xi , xj )
• Full Complexity Model: y = f (x1, ..., xn)
Linear Model can only learn a
straight line!
www.aka.ms/InterpretML-github
FAIRNESS
More positive outcomes & avoiding
harmful outcomes of AI systems for
groups of people
• Allocation: extends or withholds opportunities, resources, or information.
• Quality of service: whether a system works as well for one person as it does
for another
• Stereotyping: reinforce existing societal stereotypes
• Denigration: actively derogatory or offensive
• Over or under representation: over-represent, under-represent, or even
erase particular groups of people
Crawford et al. 2017
Types of harm
What is
Fairlearn?
A new approach to measuring and mitigating
unfairness in systems that make predictions, serve
users, or make decisions about allocating resources,
opportunities, or information.
www.aka.ms/FairlearnAI
There are many ways that an AI system can behave unfairly.
Fairness in AI
Avoiding negative outcomes of AI systems for different groups of people
A model for screening loan or job application
might be much better at picking good candidates
among white men than among other groups.
A voice recognition system might
fail to work as well for women as it
does for men.
www.aka.ms/FairlearnAI
A toolkit that empowers developers of artificial intelligence systems to
assess their systems' fairness and mitigate any observed fairness issues.
Helps users identify and mitigate unfairness in their machine learning
models with a focus on group fairness.
Automatically
analyze a model’s
predictions
Provide the user with
insights into (un)fairness of
their model’s predictions
Support (algorithmic)
methods to mitigate
unfairness
www.aka.ms/FairlearnAI
• Allocation: extends or withholds opportunities, resources, or information.
• Quality of service: whether a system works as well for one person as it does
for another
• Stereotyping: reinforce existing societal stereotypes
• Denigration: actively derogatory or offensive
• Over or under representation: over-represent, under-represent, or even
erase particular groups of people
Crawford et al. 2017
Types of harm addressed by Fairlearn
www.aka.ms/FairlearnAI
Harm of “allocation”
Example Scenarios: Lending
The data set describes whether each individual repaid the loan or not.
• [Classification] Recommends whether a given individual should get a loan. The
trained model outputs: Yes/Maybe/No decision.
Example Scenarios: School Admissions
The data set describes what was the first-year GPA of each student.
• [Regression] For a given applicant, predicts their GPA at the end of the first year.
The trained model outputs a real-valued prediction that is used as a score to
screen applicants.
www.aka.ms/FairlearnAI
Harm of “quality of service”
Example Scenarios: News Recommendation
The training data indicates what article was presented to which user, whether the user
clicked, and how much time the user spent on the article.
• [Classification] Predict which article to show to each user to optimize click-
through rate. The trained model outputs: Yes/No decision.
Two kinds of (group) fairness: across users (quality of service), or across
publishers/topics of articles (quality of service, but also allocation).
www.aka.ms/FairlearnAI
Assessment
Evaluation
Visualizations
Fairness Criteria
Mitigation Algorithm
Mitigation
• Select a protected attribute
• Select a fairness metric (e.g., disparity in recall, precision, etc
and disparity in selection rate)
Fairlearn Toolkit
• Demographic Parity
• Equalized Odds
• Postprocessing Method
• Reduction Methodwww.aka.ms/FairlearnAI
Fairness assessment
through disparity metrics
Disparity in Performance
• How the model accuracy differs across different buckets of a sensitive feature
(e.g., how accuracy of the model differs for "female" vs. "male" vs. “unspecified"
data points)
Disparity in Selection Rate
• How the model predictions differ across different buckets of a sensitive feature
(e.g., how many "female" individuals have received prediction `approved` on their
loan application in contrast to "male" and “unspecified" data points?).
www.aka.ms/FairlearnAI
Assessment
Evaluation
Visualizations
Fairness Criteria
Mitigation Algorithm
Mitigation
• Select a protected attribute
• Select a fairness metric (e.g., disparity in recall, precision, etc
and disparity in selection rate)
Fairlearn Toolkit
• Demographic Parity
• Equalized Odds
• Postprocessing Method
• Reduction Methodwww.aka.ms/FairlearnAI
Demographic parity:
Applicants of each race (gender, ...) have the
same odds of getting approval on their loan applications
Loan approval decision is independent of protected attribute
Equalized odds:
Qualified applicants have the same odds of getting approval on their
loan applications regardless of race (gender, …)
Unqualified applicants have the same odds of getting approval on their
loan applications regardless of race (gender, …)
Fairness Criteria
www.aka.ms/FairlearnAI
Reductions
approach:
Wrapper
around
standard ML
algorithms
Input:
• any standard ML training algorithm (as a
black box)
• data set including sensitive feature
Output:
• a trained model that minimizes error
subject to fairness constraints
Advantages:
• doesn’t need to access the sensitive
feature at test time
• works for a wide range of disparity metrics
• allows extracting the full disparity-accuracy
frontier
Disadvantages:
• requires re-training: the black box is called
10-20 times
www.aka.ms/FairlearnAI
Post
processing:
Picking a fair
threshold rule
Input:
• an existing (already trained) scoring model
• data set including sensitive feature
Output:
• the most accurate among all fair threshold rules (a
separate threshold for each subpopulation)
Advantages:
• simplicity
• no need to re-train the model
Disadvantages:
• requires sensitive feature at test-time
• doesn’t allow trade-offs between disparity and
accuracy
www.aka.ms/FairlearnAI
Demo of
Interpretability for
Tabular Data in
Azure Databricks
Hardware Performance Dataset - The
Regression goal is to predict the
performance of certain combinations
of hardware parts.
www.aka.ms/InterpretML-github
www.aka.ms/DatabricksRuntimeML
Azure ML
ServeStore Prep and trainIngest
Power BIAzure Data Factory Azure Data Lake Storage
Azure Kubernetes Service
Model Serving
Cosmos DB, SQL DB
Operational Databases
Azure Synapse Analytics
Streaming data
Azure Databricks
Azure Machine
Learning
Apps
Batch data
Ad-hoc analysis
Azure Event Hubs
Reference architecture
Provisioning Azure Databricks WORKSPACE
© Microsoft Corporation
Fast, easy, and collaborative Apache Spark-based analytics platform
Azure Databricks for machine learning modeling
Tools InfrastructureFrameworks
Leverage powerful GPU-enabled VMs
pre-configured for deep neural
network training
Use HorovodEstimator via a native
runtime to enable build deep learning
models with a few lines of code
Full Python and Scala support for
transfer learning on images
Automatically store metadata in
Azure Database with geo-replication
for fault tolerance
Use built-in hyperparameter tuning
via Spark MLLib to quickly drive
model progress
Simultaneously collaborate within
notebooks environments to streamline
model development
Load images natively in Spark
DataFrames to automatically decode
them for manipulation at scale
Improve performance 10x-100x over
traditional Spark deployments with
an optimized environment
Seamlessly use TensorFlow, Microsoft
Cognitive Toolkit, Caffe2, Keras, and more
© Microsoft Corporation
www.aka.ms/DatabricksRuntimeML
Demo dataset
Breast Cancer Wisconsin
(Diagnostic) Data Set
Features are computed
from a digitized image of a
fine needle aspirate (FNA)
of a breast mass. They
describe characteristics of
the cell nuclei present in
the image. A few of the
images can be found
at [Web Link]
Attribute Information:
1) ID number
2) Diagnosis (M = malignant, B = benign)
3-32)
Ten real-valued features are computed for each cell
nucleus:
a) radius (mean of distances from center to points on the
perimeter)
b) texture (standard deviation of gray-scale values)
c) perimeter
d) area
e) smoothness (local variation in radius lengths)
f) compactness (perimeter^2 / area - 1.0)
g) concavity (severity of concave portions of the contour)
h) concave points (number of concave portions of the
contour)
i) symmetry
j) fractal dimension ("coastline approximation" - 1)
© Microsoft Corporation
Install azureml-interpret and azureml-contrib-interpret
packages.
© Microsoft Corporation
Train a sample model in a local Jupyter notebook.
© Microsoft Corporation
Call the explainer locally.
© Microsoft Corporation
Explain the entire model behavior (global explanation)
© Microsoft Corporation
© Microsoft Corporation
Explain an individual prediction (local explanation)
© Microsoft Corporation
© Microsoft Corporation
© Microsoft Corporation
Mehrnoosh Sameki
Senior Product Manager
Minsoo Thigpen
Product Manager
Ehi Nosakhare
Machine Learning Scientist
Article:
Machine Fairness
How to assess AI system’s fairness
and mitigate any observed
unfairness issues
www.aka.ms/Fairlearn-build2020
Resources
➢www.aka.ms/InterpretML-github
➢www.aka.ms/InterpretML-toolkit
➢www.aka.ms/InterpretML-doc
➢www.aka.ms/FairlearnAI
➢www.aka.ms/FairlearnAIDoc
➢www.aka.ms/ResponsibleMLDoc
➢www.aka.ms/AzureResponsibleML
➢www.aka.ms/AzureMLDoc
➢www.aka.ms/AzureMLservice
Thank You!