# Detecting and Processing Unuspected Sensitive Variables for Robust Machine Learning
## 2 Algorithmic Biases in Machine Learning
### Definitions  
Let \(X\) be the observed input data, \(Y\) are the corresponding outputs to forecast and \(A\) is the sensitive variable that induces an undesirable bias in the predictions (introduced in Section 1), which can be explicitly known or deduced from \((X,Y)\). In a supervised framework, the prediction model \(f_{\theta}\) is optimised so that its parameters \(\theta\) minimise an empirical risk \(R(Y,\hat{Y})\), which measures the error of forecasting \(Y\), with \(\hat{Y}:=f_{\theta}(X)\). We will denote \(\mathcal{L}(Z)\) as the distribution of a random variable \(Z\). An image is defined as an application \(X:K_{1}\times K_{2}\mapsto\mathbb{R}^{d}\), where \(K_{1}\) and \(K_{2}\) are two compact sets representing the pixel domain (\(K_{3}\) and \(k_{4}\) can also be considered for 3D or 3D+t images) and \(d\) is the number of image channels (e.g., \(d=3\) for RGB images). We will consider 2D images with \(d=1\) in the remainder of this section to keep the notations simple. An image can, thus, be interpreted as an application mapping each of its coordinates \((i,j)\) to a pixel intensity value \(X(i,j)\). Metadata, denoted here by meta, can also be associated with this image. They represent its characteristics or extra information such as the image caption, its location or even details on the sensor(s) used to acquire or to register it. In an ML setting, the variable to forecast is the output observation \(Y\). Algorithmic biases are usually assessed with respect to a variable called the sensitive variable, \(A\), which may be either a discrete variable or a continuous variable. In the discrete case, a fairness objective is to measure dissimilarities in the data and/or to discover differences in the algorithm's behaviour between samples having different sensitive variable values--i.e., corresponding to different subgroups. Thus, a complete dataset contains the images \(X\), their corresponding target variables \(Y\), image metadata meta and the sensitive variable \(A\). Bias can manifest itself in multiple ways, depending on how the variable which causes the bias influences the different distributions of the data and the algorithm. Bias can originate from the mismatch between the different data distributions in the sense that small subgroups of individuals have different distributions, i.e., \(\mathcal{L}(Y,X|A)\
eq\mathcal{L}(Y,X)\). This is the most common example that we can encounter in image datasets. The first consequence can be a **sampling bias**, and can discourage the model from learning the particularities of the under-represented groups or classes. As a consequence, despite achieving a good average accuracy on the test samples, the prediction algorithm may exhibit poor generalisation properties when deployed on real-life applications with different subsets of distributions. Another case emerges when external conditions, which are not relevant for the experiment, induce a difference in the observed data's labels in the sense that \(\mathcal{L}(Y|X,A)\
eq\mathcal{L}(Y|X)\). This, therefore, inadvertently encourages ML models to learn biased decisions, as in the wolves versus huskies example in [22]. This is the case when the data are collected with labels that are influenced by a third unknown variable leading to **confounding bias**, or when the observation setting favours one class over the other leading to **selection bias**. The sources of this bias may be related to observation tools, methods or external factors, as it will be pointed out later. A third interesting case concerns the bias induced by the model itself, which is often referred to as **inductive bias**: \(\mathcal{L}(\hat{Y}|X,Y,A)\
eq\mathcal{L}(\hat{Y}|X,Y)\). This opposes the _world created by the algorithm_--i.e., the distribution of the algorithm outputs--to the original data.