Machine learning model fairness and interpretability are critical for data scientists, researchers and developers to explain their models and understand the value and accuracy of their findings. Interpretability is also important to debug machine learning models and make informed decisions about how to improve them. In this session, Francesca will go over a few methods and tools that enable you to “unpack" machine learning models, gain insights into how and why they produce specific results, assess your AI systems fairness and mitigate any observed fairness issues.
Using open source fairness and interpretability packages, attendees will learn how to:
- Explain model prediction by generating feature importance values for the entire model and/or individual datapoints.
- Achieve model interpretability on real-world datasets at scale, during training and inference.
- Use an interactive visualization dashboard to discover patterns in data and explanations at training time.
- Leverage additional interactive visualizations to assess which groups of users might be negatively impacted by a model and compare multiple models in terms of their fairness and performance.
18. 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
19. 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
21. 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
23. 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
24. 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
25. 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
26. 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
27. 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
30. • 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
31. 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
32. 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
33. 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
34. • 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
35. 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
36. 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
38. 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
40. 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
41. 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
42. 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
43. 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
44. 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
48. 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)