In deployed machine learning systems that affect people’s lives, it is important to ensure that your model is not resulting in disparate impact for some sub-populations of your data. The typical populations of concern might be the so-called protected basis variables such as race, age, or sex, but can also be any subgroup which is relevant to your industry. Creating ML systems that are fair can be tricky due to the complexities of data used for training.
If you want to ensure that your model isn’t resulting in disparate impact across sex, it might be tempting to simply not use sex as an input variable into the model. This tactic, often referred to as fairness-through-unawareness, is insufficient. Even though the model doesn’t know about sex explicitly, it is highly likely that some other input feature (or combination of features) can act as a highly effective proxy for what you were trying to hide from the model.
Many approaches to FairML have focused on mitigating unfairness either by augmenting the training data, the training algorithm, or the model’s outputs. While these approaches help to obtain a more fair model for any given set of inputs, they don’t illuminate for the data scientist what factors were resulting in the model bias. As the model developer, it is helpful to have full awareness of which features are acting as proxies for sensitive attributes. In this post, we describe a technique for effectively surfacing complex combinations of features which act as proxies for a sensitive attribute.
Proxies
Being able to identify proxies can aid the model developer in being judicious about feature selection and model development. At a first pass, identifying proxy variables is as simple as determining which variables have high correlation with a sensitive attribute, and then choosing whether or not to omit those variables. The downside of this approach is that measures of correlation (perhaps Pearson correlation or mutual information) will marginalize over the full domain, perhaps averaging out important effects only seen for some specific values. Further, it could be the case that pairwise combinations (or higher-order) of features are able to form highly effective proxies, more so than any univariate features.
To accomplish this, we’ll rely on the techniques of Frequent Pattern Mining and Association Rule Mining. This will allow us to surface exactly which values of a variable, and higher-order combinations thereof, are acting as strong proxies for any sensitive attributes.
Association Rules
Association Rule Mining is a rather classic technique in unsupervised pattern discovery, and it can be especially useful in the context of FairML and proxies. The ideas often stem from “market basket analysis”, which imagines we have a large database of purchases at a supermarket. For each shopper, we know what items they bought together, such as {milk, eggs, cheese} for one shopper and {diapers, beer} for another. From the co-occurrences of items in baskets, our goals are to (1) identify commonly co-occurring items and (2) identify directional correlations. For our first goal, we can use Frequent Pattern Mining techniques such as FPGrowth, which will result in a list of item combinations that were highly probable in the dataset. Going a step further, we can apply Association Rule Mining to identify not just correlated items, but items correlated with a particular directionality. For example, if a person bought sunglasses and a bathing suit, then maybe they also bought sunscreen. But if all we know is that they bought sunscreen, they’re not necessarily in the market for new shades.
Association Rules are of the form “if A, then B”. The antecedent A can be one or more items, and the consequent B can be one or more items. Importantly, we’re not looking solely for relationships that are 100% fulfilled in our dataset. Instead, we’re looking for consequents that follow antecedents with higher probability than we might expect. Quantifying those base-level expectations means we have to introduce some new terminology and measures.
Measures
For a particular itemset (whether it is an antecedent, consequent, or neither), the support for that itemset is a measure of how frequently the itemset occurs in the data. We can think of it as the overall probability of occurrence for an itemset. Note that for a particular itemset, we need to tabulate not just exact matches to that itemset, but also all other larger itemsets that include at least that one. An itemset with high support (like 0.80) would mean that 80% of the dataset is exactly this itemset. As you might imagine, itemsets with fewer items tend to have more support than itemsets with more items. For example, the itemset {milk} probably occurred in many of our shoppers’ baskets, whereas the combination of {milk, lettuce, hat} was probably more rare.
For a particular rule “if A, then B”, the confidence quantifies how often that rule was true. Another way to think about it is: Whenever you saw A, what’s the probability that you would see B? Naturally, if a rule were a really strong correlation, then confidence in the consequent would be close to 100%. In contrast, for a weaker relationship, knowing about antecedent A perhaps doesn’t give us much certainty at all about B.
Other useful concepts such as lift and conviction will help us quantify the extent to which A helps us predict B more than we’d be able to predict B otherwise.
Mining for Proxies
Identifying Proxies for Sex
We’ll use the UCI Adult dataset, which includes financial and demographic data about a group of 30,000 adults. While this dataset is often used for classification tasks (predicting if a person has high income), we’ll ignore for now the supervised learning aspect. Instead we’ll focus on some of the demographic variables (such as Sex or Race) and investigate whether these can be proxied by other variables (such as Education, Occupation, MaritalStatus and so on).
We’ll focus on Sex and use Association Rule Mining to identify strong proxies. For generating candidate itemsets, we’ll focus first on categorical variables. Continuous variables can be easily incorporated by discretizing their domains, either manually (such as quartiles) or by dynamically identifying bin splits (in a similar spirit to decision tree algorithms). It is up to us to identify how many input features we might include for itemsets and what order of combinations we want to consider. For ease of interpretability, we might constrain ourselves to first-, second-, and third-order combinations. That is, in the antecedents of our rules, we’ll only want to consider itemsets with one, two, or three items. This choice is up to us, depending on what level of rule complexity we want to access. As we increase this complexity, the combinatorics of itemset and rule generation expands. Luckily, algorithms such as FPGrowth, which are based on tree structures, will allow us to apply these ideas to large datasets and complex itemsets, if we desire.
Intuitively, these results are unsurprising: many jobs are highly correlated with males or females. But we now have a more precise way to understand this effect. The support of each rule tells us how prevalent a particular combination is in the data, and the confidence tells us how certain the proxying can be.
This analysis is easy to apply to any sensitive attributes we want to explore. We could identify proxies for certain races, age groups, health conditions, and so on.
Next Steps
Given how informative some of these combinations can be, it would be unsurprising for an ML model to pick up on these proxies even if it didn’t have direct access to sensitive attributes. Any sufficiently complex algorithm (even just a decision tree or tree ensemble) should easily be able to capture the simple combinations highlighted here, if they are helpful in predicting the target variable. Surfacing these relationships should be an early part of the model development process and should play a role in feature selection. Ultimately, our goal must be to mitigate disparate impact in the final system. With this clarity into proxies, we could choose to (i) omit certain variables from a model, (ii) omit/recode certain values of a variable from the model, or (iii) turn to training-time and post-hoc methods for bias mitigation.