There are two components to Arthur’s approach to bias: first, monitoring, and second, mitigation.
Monitoring Attributes for Bias¶
For some of the attributes in your model, you may want to pay particular attention to how your model’s outputs are potentially different for each subpopulation of that attribute. We refer to this as monitoring an attribute for bias. A common example might be so-called protected basis variables such as race, age or gender. But you can define any attributes that are important for your business case and select them for bias monitoring.
Model Input Attributes¶
If you have already registered a few input attributes of your model, you can set a subset of them to be monitored for bias. For a categorical variable, each possible level of the attribute will be treated as a distinct sub-population for analysis. For example, if you had an attribute for “Gender” which comprised the three possible values
Non-Binary, then you would simply add the following to your model onboarding.
arthur_model.get_attribute("SEX", stage=Stage.ModelPipelineInput ).monitor_for_bias = True
For a continuous variable, you need to break the continuous range into a fixed number of groupings so that we can create sub-populations. You can do this by providing cutoff thresholds for each grouping. For example, if we have a continuous attribute called
AGE, we can create three age brackets such as
35 - 55, and
> 55. We create these groups by providing the upper-cutoff values for each group.
arthur_model.get_attribute("AGE", stage=Stage.ModelPipelineInput ).monitor_for_bias = True arthur_model.get_attribute("AGE", stage=Stage.ModelPipelineInput ).set(bins = [None, 35, 55, None])
You can monitor for bias even if the sensitive attributes are not direct input to your model.
arthur_model.get_attribute("SEX", stage=Stage.NonInputData ).monitor_for_bias = True
Then, when you send inferences, you can include this side information in the
NonInputData fields. This allows you to determine if your model potentially has a disparate impact on certain sub-populations.
Viewing Fairness Metrics¶
On the Arthur Dashboard, you can view the outcomes of your model with respect to the sensitive attributes and sub-populations you defined.
We have also defined a few convenience functions on the
ArthurModel object through the
Finer-grained metrics can also be achieved through our query endpoint.