# Comprehensive Validation on Reweighting Samples for Bias Mitigation via AIF360
## 2 Methodology
### Reweighting Samples  
Fairness in AI can be conceptualized as a multi-objective optimization challenge, aiming to optimize learning objectives while mitigating discrimination with respect to sensitive attributes [5]. In essence, achieving fairness may involve a trade-off in learning performance to minimize bias. Data preprocessing emerges as an effective technique for molding training data to foster fairness in AI. Techniques such as suppression, dataset massaging, and reweighting samples have proven effective [5].  
Reweighting samples, a specific preprocessing technique, involves adjusting the significance or contribution of individual samples within the training dataset. By strategically assigning weights, it becomes possible to render the training dataset free from discrimination concerning sensitive attributes, all without altering the existing labels. One approach to determining these weights involves measuring them based on the frequency counts associated with the sensitive attribute [9].  
This paper leveraged the reweighting samples technique from AIF360 during data preprocessing to enhance fairness in binary classification. The input for the reweighting process comprises a training dataset with samples containing attributes (including a sensitive attribute) and labels, along with the specification of the sensitive attribute. The output is a transformed dataset where sample weights are adjusted concerning the sensitive attribute, mitigating potential classification bias. Throughout the reweighting process, an analysis of the distribution of the sensitive attribute within different groups is conducted. This analysis informs the calculation of reweighting coefficients, which, in turn, adjust sample weights to promote a more uniform distribution across groups.  
Given a sensitive (protected) attribute, the privileged group of samples includes the samples with the positive sensitive attribute while the unprivileged group of samples includes the samples with the negative sensitive attribute. For a binary classification task, reweighting samples adjusts the weights of four categories of samples, namely \(w_{pp}\) (the weight of the positive privileged sample (pp)), \(w_{pup}\) (the weight of positive unprivileged samples (pup)), \(w_{np}\) (the weight of negative privileged samples (np)), and \(w_{nup}\) (the weight of negative unprivileged samples (nup)), as below.  
\[w_{pp}=\frac{N_{p}}{N_{total}}\times\frac{N_{pos}}{N_{pp}} \tag{1}\]  
\[w_{pup}=\frac{N_{up}}{N_{total}}\times\frac{N_{pos}}{N_{pup}} \tag{2}\]  
\[w_{np}=\frac{N_{p}}{N_{total}}\times\frac{N_{neg}}{N_{np}} \tag{3}\]  
\[w_{nup}=\frac{N_{up}}{N_{total}}\times\frac{N_{neg}}{N_{up}}, \tag{4}\]  
where  
\(N_{p}\): the number of samples in the privileged group.  
\(N_{pp}\): the number of samples with the positive class in the privileged group.  
\(N_{np}\): the number of samples with the negative class in the privileged group.  
\(N_{np}\): the number of samples in the unprivileged group.  
\(N_{pup}\): the number of samples with the positive class in the unprivileged group.  
\(N_{nup}\): the number of samples with the negative class in the unprivileged group.  
\(N_{pos}\): the number of samples with the positive class.  
\(N_{neg}\): the number of samples with the negative class.  
\(N_{total}\): the number of samples.