# Detecting and Processing Unuspected Sensitive Variables for Robust Machine Learning
## 3 Measuring Algorithmic Biases  
A wide variety of algorithmic bias, or fairness, metrics have been introduced to quantify unfair decisions, as presented in [64; 65; 28; 66] and references therein. They quantify different levels of relationships between a given sensitive variable \(A\) and outputs of the algorithm. Yet, as fairness is a polysemous word, there exist multiple metrics, each one focusing on a particular definition of bias and, unfortunately, all of them are not necessarily compatible with each other, as recently discussed in [27; 67]. Therefore, it is essential for someone evaluating the bias of a model to understand what the algorithmic bias metrics really capture. They conform to different definitions of biases given in the previous section and can be decomposed as follows. * Statistical Parity One of the most standard measures of algorithmic bias is the so-called _Statistical Parity_. Balanced decisions in the sense of Statistical Parity are then reached when the model outputs are not influenced by the sensitive variable value--i.e., \(\mathcal{L}(\hat{Y}|A)=\mathcal{L}(\hat{Y})\). For a binary decision, it is often quantified using the Disparate Impact (DI) metric. Introduced in the US legislation in 1971 ([[https://www.govinfo.gov/content/pkg/CFR-2017-title29-vol4/xml/CFR-2017-title29-vol4-part1607.xml](https://www.govinfo.gov/content/pkg/CFR-2017-title29-vol4/xml/CFR-2017-title29-vol4-part1607.xml)]([https://www.govinfo.gov/content/pkg/CFR-2017-title29-vol4/xml/CFR-2017-title29-vol4-part1607.xml](https://www.govinfo.gov/content/pkg/CFR-2017-title29-vol4/xml/CFR-2017-title29-vol4-part1607.xml)), accessed on 30 October 2023) it measures how the outcome of the algorithm \(\hat{Y}=f_{\theta}(X)\) depends on \(A\). It is computed for a binary decision as \[DI(f)=\frac{\mathbb{P}(f_{\theta}(X)=1|A=0)}{\mathbb{P}(f_{\theta}(X)=1|A=1)}\,,\] where \(A=0\) represents the group which may be discriminated (also called _minority group_) with respect to the algorithm. Thus, the smaller the value, the stronger the discrimination against the _minority group_; while a \(DI(f)=1\) score means that Statistical Parity is reached. A threshold \(\tau_{0}=0.8\) is commonly used to judge whether the discrimination level of an algorithm is acceptable [68; 69; 70]. * Equal performance metrics family Taking into account the input observations \(X\) or the prediction errors can be more proper in various applications than imposing the same decisions for all. To address this, the notions of _equal performance_, _status-quo preserving_, or _error parity_ measure whether a model is equally accurate for individuals in the sensitive and non-sensitive groups. As discussed in [27], it is often measured by using three common metrics: _equal sensitivity_ or _equal opportunity_[64], _equal sensitivity and specificity_ or _equalised odds_, and _equal positive predictive value_ or _predictive parity_[71]. In the case of a binary decision, common metrics usually compute the difference between True Positive Rate and/or False Positive Rate for majority and minority groups. Therefore, algorithmically unbiased decisions in the sense of _equal performance_ are reached when this difference is zero. Specifically, an _equal opportunity_ metric is given by  
\[\left|\mathbb{P}(\hat{Y}=1|A=0,Y=1)-\mathbb{P}(\hat{Y}=1|A=1,Y=1)\right|,\]  
while an _equality of odds_ metric is provided by  
\[\left|\mathbb{P}(\hat{Y}=1|A=0,Y=0)-\mathbb{P}(\hat{Y}=1|A=1,Y=0)\right|.\]  
Note finally that, _predictive parity_ refers to Equal accuracy (or error) in the two groups also corresponds to refered by. * Calibration Previous notions can be written using the notion of **calibration** in fair machine learning. When the algorithm's decision is based on a score \(s(X)\), as in [72], a calibration metric is defined as \[\left|\mathbb{P}(Y=1|A=0,s(X))-\mathbb{P}(Y=1|A=1,s(X))\right|.\] Calibration measures the proportion of individuals that experience a situation compared to the proportion of individuals forecast to experience this outcome.