=Paper= {{Paper |id=Vol-3276/SSS-22_FinalPaper_69 |storemode=property |title=Fairness-aware Naive Bayes Classifier for Data with Multiple Sensitive Features |pdfUrl=https://ceur-ws.org/Vol-3276/SSS-22_FinalPaper_69.pdf |volume=Vol-3276 |authors=Stelios Boulitsakis-Logothetis |dblpUrl=https://dblp.org/rec/conf/aaaiss/Boulitsakis-Logothetis22 }} ==Fairness-aware Naive Bayes Classifier for Data with Multiple Sensitive Features== https://ceur-ws.org/Vol-3276/SSS-22_FinalPaper_69.pdf
   Fairness-aware Naive Bayes Classifier for Data with Multiple Sensitive Features

                                                                  Stelios Boulitsakis-Logothetis
                                                                            University of Durham
                                                                         Durham, United Kingdom
                                                                      stelios.b.logothetis@gmail.com



                                     Abstract                                             tion here in Table 1. Traditionally, the proposed notions have
                                                                                          been classified into two categories. The simplest and most
   Fairness-aware machine learning seeks to maximise utility in                           well-studied, group fairness, is based on defining distinct
   generating predictions while avoiding unfair discrimination
   based on sensitive attributes such as race, sex, religion, etc.
                                                                                          protected groups in the given data. Then, for each of these
   An important line of work in this field is enforcing fairness                          groups, a user-selected statistical constraint must be satis-
   during the training step of a classifier. A simple yet effec-                          fied. This has notable disadvantages: It requires groups to be
   tive binary classification algorithm that follows this strategy                        treated fairly in aggregate, but this guarantee does not nec-
   is two-naive-Bayes (2NB), which enforces statistical parity -                          essarily extend to individuals (Awasthi et al. 2020). Further,
   requiring that the groups comprising the dataset receive pos-                          different statistical constraints prioritise different aspects of
   itive labels with the same likelihood. In this paper, we gen-                          fairness. Many of them have also been shown to be incom-
   eralise this algorithm into N-naive-Bayes (NNB) to eliminate                           patible with each other, making the choice even more diffi-
   the simplification of assuming only two sensitive groups in                            cult for users. Finally, the choice of the protected groups that
   the data and instead apply it to an arbitrary number of groups.                        should be considered is an open question (Blum et al. 2018;
   We propose an extension of the original algorithm’s statistical                        Kleinberg, Mullainathan, and Raghavan 2017).
   parity constraint and the post-processing routine that enforces
   statistical independence of the label and the single sensitive
                                                                                             An orthogonal notion to group fairness is individual fair-
   attribute. Then, we investigate its application on data with                           ness. Put simply, this notion requires that ”similar individu-
   multiple sensitive features and propose a new constraint and                           als be treated similarly” (Dwork et al. 2012). This approach
   post-processing routine to enforce differential fairness, an ex-                       addresses the previous lack of any individual-level guaran-
   tension of established group-fairness constraints focused on                           tees. However, it requires strong functional assumptions and
   intersectionalities. We empirically demonstrate the effective-                         still requires the step of choosing an underlying metric over
   ness of the NNB algorithm on US Census datasets and com-                               the dataset features (Awasthi et al. 2020).
   pare its accuracy and debiasing performance, as measured by                               Alternative models of fairness have been proposed to ad-
   disparate impact and DF-ϵ score, with similar group-fairness
                                                                                          dress the disadvantages of the two traditional definitions.
   algorithms. Finally, we lay out important considerations users
   should be aware of before incorporating this algorithm into                            One model is causal fairness, which examines the unfair
   their application, and direct them to further reading on the                           causal effect the sensitive attribute value may have on the
   pros, cons, and ethical implications of using statistical parity                       prediction made by an algorithm (Mhasawade and Chunara
   as a fairness criterion.                                                               2021). Another, which is explored in this paper, is differ-
                                                                                          ential fairness (DF). This is an extension of the established
                                                                                          group fairness concepts that applies them to the case of inter-
                             1     Introduction                                           sectionalities, meaning groups that are defined by multiple
Today, countless machine learning-based systems are in use                                overlapping sensitive attributes (Foulds et al. 2020; Morina
that autonomously make decisions or aid human decision-                                   et al. 2019).
makers in applications that significantly impact individu-                                   A similar model is statistical parity subgroup fairness
als’ lives. This has made it vital to develop ways of en-                                 (SF), which focuses on mitigating intersectional bias by ap-
suring these models are trustworthy, ethical, and fair. The                               plying group fairness to the case of infinitely many, very
field of fairness-aware machine learning is centered on en-                               small subgroups (Kearns et al. 2018). SF and DF are no-
hancing the fairness, explainability, and auditability of ML                              table because they both enable a more nuanced understand-
models. A goal many research works in this field share is                                 ing of unfairness than when a single sensitive attribute and
to maximise utility in generating predictions while avoiding                              broad, coarse groups are considered. A key difference be-
discrimination against people based on specific sensitive at-                             tween them, however, is DF’s focus on minority groups. The
tributes, such as race, sex, religion, nationality, etc.                                  SF measure of subgroup parity weighs larger groups more
   Researchers have devised many formalisations to try and                                heavily than very small ones, while DF-parity considers all
capture intuitive notions of fairness, each with different pri-                           groups equally. This means DF can provide greater protec-
orities and limitations. We summarise the ones we will men-                               tion to very small minority groups since, in SF, their impact
___________________________________
In T. Kido, K. Takadama (Eds.), Proceedings of the AAAI 2022 Spring Symposium
“How Fair is Fair? Achieving Wellbeing AI”, Stanford University, Palo Alto, California,
USA, March 21–23, 2022. Copyright © 2022 for this paper by its authors. Use permitted
under Creative Commons License Attribution 4.0 International (CC BY 4.0).


                                                                                                                                                   56
on the overall score is reduced (Foulds et al. 2020).              Name            Definition
   Despite the lack of consensus on any universal notion of
fairness, research has proceeded using the existing models.        Statistical     Likelihood of positive prediction given group
A major line of work in the development of fair learning al-       Parity          membership should be equal for all groups.
gorithms is enforcing fairness during the training step of a       Disparate       Mean ratio of positive predictions for each pair
classifier (Donini et al. 2018). A simple yet effective algo-      Impact          of groups should be 1 or greater than p%.
rithm that follows this strategy is Calders and Verwer’s two-
naive-Bayes algorithm (Calders and Verwer 2010) (2NB).             Subgroup        Group fairness applied to infinite number of
This algorithm was originally proposed as one of three ways        Fairness        very small groups.
of pursuing fairness in naive Bayes classification. It received    Differential    Group fairness applied to groups defined by
further attention in the 2013 publication (Kamishima et al.        Fairness        multiple overlapping sensitive attributes.
2013) which asserted its effectiveness in enforcing group
fairness in binary classification and explored its underlying      Individual      Distance between the likelihood of outcomes
statistics. It works by training separate naive Bayes classi-      Fairness        between any two individuals should be no
fiers for each of the two (by assumption) groups comprise                          greater than similarity distance between them.
the dataset, the privileged and the non-privileged group.          Causal          Use of causal modelling to find effect of sensi-
Then, the algorithm iteratively assesses the fairness of the       Fairness        tive attributes on predictions.
combined model and makes small changes to the observed
probabilities in the direction of making them more fair                Table 1: Some notable formalisations of fairness.
(Friedler et al. 2019).
   A recent publication exploring the arguments for and
against statistical parity (Räz 2021) has served as motiva-      Related Work
tion to re-visit algorithms based around it. Statistical parity
(also referred to as demographic parity or independence) is       Naive Bayes Naive Bayes is a probabilistic data mining
a group fairness notion which requires that the groups com-       and classification algorithm. In spite of its relative simplic-
prising the dataset receive positive labels with the same like-   ity, it has been shown to be very competent in real-world ap-
lihood. An assumption that is at the core of 2NB and many         plications that require classification or class probability esti-
other research works, however, is that of a single, binary        mation and ranking1 . Various strategies have been explored
sensitive feature (Oneto, Donini, and Pontil 2020). This as-      for improving the algorithm’s performance by weakening its
sumption has been noted to rarely hold in the real world, and     conditional independence assumption. These include struc-
eliminating it is one of the essential goals of the previously    ture extension, attribute weighting, etc. These techniques
introduced notions of differential fairness and subgroup par-     focus on maximising accuracy or averaged conditional log
ity fairness (Foulds et al. 2020; Kearns et al. 2018).            likelihood (Jiang 2011). Calders and Verwer’s proposal of
   This opens the question of how 2NB can be applied to           composing multiple naive Bayes models instead aims to en-
data with multiple, overlapping sensitive attributes while        force independence of predictions with respect to a binary
avoiding oversimplification. The 2NB algorithm is applica-        sensitive feature, thus satisfying the statistical parity con-
ble to a wide range of tasks and its effectiveness, even in       straint between the two groups (Calders and Verwer 2010).
comparison to more complex algorithms, has been demon-
                                                                  Fair Classification There is a large body of research into
strated (Kamishima et al. 2013; Friedler et al. 2019). At the
                                                                  designing learning methods that do not use sensitive infor-
same time, its’ design is sufficiently elegant and intuitive to
                                                                  mation in discriminatory ways (Oneto, Donini, and Pontil
be approachable to practitioners across many disciplines - an
                                                                  2020). As mentioned, various formalisations of fairness ex-
important advantage. Thus, extending the algorithm to cover
                                                                  ist but the most well-studied one is group fairness (Blum
more use cases will be the focus of this work.
                                                                  et al. 2018). Many algorithms designed around this notion
Contributions                                                     are introduced as part of the comparative experiment in Sec-
                                                                  tion 3.
This paper seeks to build upon Calders and Verwer’s work             A more recent proposal, differential fairness (DF), ex-
by exploring the following:                                       tends existing group fairness concepts to protect subgroups
 • We adapt the original 2NB structure and balancing rou-         defined by intersections of and by individual sensitive at-
   tine to support multiple, polyvalent (categorical) sensi-      tributes. The original papers by (Foulds et al. 2020) and
   tive features.                                                 (Morina et al. 2019) explore the context of intersectionality,
 • We use this new property of the algorithm to apply it to       and provide comparisons of DF with established concepts.
   differential fairness.                                         The first paper asserts DF’s distinction from subgroup parity
 • To support the above, we examine the extended algo-            and demonstrates its usefulness in protecting small minority
   rithm’s performance on real-world US Census data.              groups. The latter paper gives methods to robustly estimate
                                                                  the DF metrics and proposes a post-processing technique to
 • Finally, we lay out important considerations users should      enforce DF on classifiers.
   be aware of before using this algorithm. We draw upon
   the literature to lay out the pros, cons, and ethical impli-      1
                                                                       Recent, novel applications include (Valdiviezo-Diaz et al.
   cations of using statistical parity as a fairness criterion.   2019; Feng et al. 2018; Niazi et al. 2019) among others.




                                                                                                                           57
Humanistic Analysis A line of work that is parallel to               final predicted class probabilities, for a sample xs (where x
fair algorithm development focuses on analysing these pro-           is the feature vector excluding the sensitive feature s), is:
posals from an ethical, philosophical, and moral standpoint.
A recent such publication, which examines statistical par-
ity among other notions, and which motivated and influ-                           P (y|xs) = P (x|y) ∗ P (s|y) ∗ P (y)                 (2)
enced this paper, is by Hertweck, Heitz, and Loi (Her-                                     = Cs (x) ∗ P (s|y) ∗ P (y)                  (3)
tweck, Heitz, and Loi 2021). They propose philosophically-                                 = Cs (x) ∗ P (s ∩ y)                        (4)
grounded criteria for justifying the enforcement of indepen-
dence/statistical parity in a given task. They include scenar-       Where Cs is the the sub-estimator for sensitive group s ∈ S.
ios where enforcing statistical parity is ethical and justified,
as well as counter-examples where the criteria are met but
                                                                     Enforcing Statistical Parity
independence should not be enforced. As with many sim-               To satisfy the statistical parity constraint, the original 2NB
ilar works, they conclude by directing the reader to strike          algorithm runs a heuristic post-processing routine that iter-
a balance between fairness and utilitarian concerns (such as         atively adjusts the conditional probabilities P (Y |S) of the
accuracy) in their task. (Heidari et al. 2019) do similar work,      groups in the direction of making them equal. During its
laying out the moral assumptions underlying several popu-            execution, this probability-balancing routine alternates be-
lar notions of fairness. In (Räz 2021), Räz critically exam-       tween reducing N (Y = 1, S = 1) and increasing N (Y =
ines the advantages and shortcomings of statistical parity as        1, S = 0) depending on the number of positive labels out-
a fairness criterion and makes an overall positive case for it.      putted by the model at each iteration. This is to try and keep
   (Friedler, Scheidegger, and Venkatasubramanian 2016)              the resultant marginal distribution of Y stable. Once balanc-
introduce the concept of distinct worldviews which influence         ing is complete, the value of P (S|Y ) can be induced from
how we pursue fairness. One of them is that We’re All Equal          Ny,s similar to (1). The first contribution of this paper is to
(WAE) i.e. there is no association between the construct (the        extend this routine to suit the polyvalent definition of statis-
latent feature that is truly relevant for the prediction) and the    tical parity we will use:
sensitive attribute. The orthogonal worldview is that What           Definition 1. Statistical (Conditional) Parity for Polyvalent
You See Is What You Get, wherein the observed labels are             S (Ritov, Sun, and Zhao 2017):
accurate reflections of the construct. In (Yeom and Tschantz            For predicted binary labels ŷ and polyvalent sensitive fea-
2021), Yeom and Tschantz give a measure of disparity am-             ture S, statistical (conditional) parity requires 3 :
plification and dissect the popular group fairness models of
statistical parity, equalised odds, calibration, and predictive                  P (ŷ = 1|s) = P (ŷ = 1|s′ ) ∀ s, s′ ∈ S             (5)
parity through the lens of worldviews. They argue that un-              We modify the probability-balancing routine to subtract
der WAE, statistical parity is required to eliminate disparity       and add probability to the group with the highest (max) and
amplification. However, deviating from this worldviews in-           lowest (min) current P (Y = 1|s) respectively. These prob-
troduces inaccuracy when we enforce parity.                          abilities are re-computed with each iteration, and the max
                                                                     and min groups re-selected. Further, we introduce the con-
            2    N-Naive-Bayes Algorithm                             straint that only groups designated by the user as privileged
                                                                     can receive a reduction in their likelihood of getting a posi-
The proposed N-naive-Bayes algorithm is a supervised bi-             tive label 4 . This is to avoid making any assumptions about
nary classifier that allows the enforcement of a statistical         which groups it would be appropriate to demote positive
fairness constraint in its predictions. Given an (ideally large)     instances of. It allows the balancing routine to terminate
training set of labelled instances, the algorithm partitions the     immediately if it over-corrects, or if the data is such that
data based on sensitive attribute value and trains a separate        P (ŷ = 1|snp ) > P (ŷ = 1|sp ) to begin with, as is the case in
naive Bayes sub-estimator on each of the sub-sets. This is an        the well-known UCI Adult dataset, for example. This gives
extension of the original two-naive-Bayes structure, where           us the final form of our statistical parity criterion:
exactly two sub-estimators are trained. The next step of the
training stage is for the conditional probabilities P (Y |S) to      Definition 2. Statistical Parity Criterion for NNB:
be empirically estimated from the training set. Where Ns is             For predicted binary labels ŷ and sensitive feature S:
the number of instances that belong to group s, and Ny,s              P (ŷ = 1|sp ) = P (ŷ = 1|snp ) ∀ (sp , snp ) ∈ Sp × Snp (6)
the number of instances of that group that have label y, the
empirical conditional probability2 is given as:                      Where Sp and Snp are the sub-sets of all privileged and non-
                                                                     privileged sub-groups of S respectively.
                                Ny,s + α                                We adapt the above definition into a score that the algo-
                    P (y|s) =                                 (1)
                                Ns + 2 ∗ α                           rithm can minimise:
   Finally, the algorithm modifies the joint distribution
P (Y, S) to enforce the given fairness constraint. Then, the                disc = max P (ŷ = 1|sp ) − min P (ŷ = 1|snp )            (7)
   2                                                                    3
    Equation (1) gives a smoothed empirical probability, where the        The cited definition requires this to hold for all values of ŷ,
constant α is the parameter of a symmetric Dirichlet prior with      however for a binary label it is sufficient to check ŷ = 1.
                                                                        4
concentration parameter 2 ∗ α, since a binary label is assumed.           A similar constraint is explored by (Zafar et al. 2017).




                                                                                                                                  58
Algorithm 1: Pseudocode for a probability-balancing routine           This is used in experiments to estimate the value of ϵ (the
to enforce statistical parity                                      ϵ-score) from the predicted labels on the dataset5 . In exper-
 1: Calculate the parity score, disc, of the predicted classes     iments we set β = 2 ∗ α and substitute with the observed
      by the current model and store smax , smin                   conditional probability estimates from the dataset. An addi-
 2: while disc > disc0 do                                          tional measure given in (Foulds et al. 2020) to assess fair-
 3:   Let numpos be the number of positive samples by              ness from the standpoint of intersectionality is differential
      the current model                                            fairness bias amplification. This measure gives an indication
 4:   if numpos < the number of positive samples in the            of how much a black-box classifier increases the unfairness
      training set then                                            over the original data (Foulds et al. 2020; Zhao et al. 2017).
 5:      N (y = 1, smin ) + = ∆ ∗ N (y = 0, smin )                 Definition 5. Differential Fairness Bias Amplification
 6:      N (y = 0, smin ) − = ∆ ∗ N (y = 0, smin )                    A classifier C satisfies (ϵ2 − ϵ1 )-DF bias amplification
 7:   else                                                         w.r.t. dataset D if C is ϵ2 -DF fair and D is ϵ1 -DF fair.
 8:      N (y = 1, smax ) + = ∆ ∗ N (y = 1, smax )                    To adjust the joint distribution P (Y, S) to minimise sat-
 9:      N (y = 0, smax ) − = ∆ ∗ N (y = 1, smax )                 isfy DF-fairness and minimise the ϵ-score, we propose a
10:   end if                                                       new heuristic probability-balancing routine and associated
11:   If any N (y, s) is now negative, rollback the changes        discrimination score. The distinction from the balancing
      and terminate                                                routine given in Algorithm 1 is that this focuses on out-
12:   Recalculate P (Y |S), disc, smax , smin                      putting a narrower range of probabilities, while still avoid-
13: end while                                                      ing negatively impacting groups that are designated as non-
                                                                   privileged. To form the new discrimination score, we ap-
                                                                   ply the principle of separating privileged and non-privileged
   Note that the above criterion can easily be relaxed to ap-
                                                                   sub-groups of S from the previous section to the ϵ-score def-
ply the four-fifths rule for removing disparate impact (or its
                                                                   inition:
more general form, the p% rule (Zafar et al. 2017)) instead
of perfect statistical parity. For the purposes of this paper,
however, we explore the effect of statistical parity in its base             P (ŷ = 1|snp )
                                                                     e−ϵ ≤                   ≤ eϵ ∀ (sp , snp ) ∈ Sp × Snp (10)
form.                                                                        P (ŷ = 1|sp )
   We also note the definition of disparate impact we use in
the evaluation stage:                                                We then express this restricted ϵ-score as the maximum of
                                                                   two ratios: eϵ = max(ρd , ρu ), where for (sp , snp ) ∈ Sp ×
Definition 3. Disparate Impact (Mean) for Polyvalent S:            Snp :
                    1        X P (ŷ = 1|snp )
              |Sp × Snp |           P (ŷ = 1|sp )                               P (ŷ = 1|snp )            P (ŷ = 1|sp )
                          (sp ,snp )
                                                                    ρd = max                     , ρu = max                 (11)
   Algorithm 1 describes the extended probability balanc-                        P (ŷ = 1|sp )             P (ŷ = 1|snp )
ing heuristic for enforcing parity. The values of sp , snp in         The execution of the proposed balancing routine is de-
the parity criterion (Equation 7) are referred to as smax and      termined by these ratios. If ρd is greater, then the non-
smin respectively. At each iteration, the routine determines       privileged sub-group with smallest probability at that itera-
these groups and adjusts their conditional probabilities. A        tion receives an increase in probability. If ρu is greater, then
further modification from the original is that the proportion      the privileged group with highest probability receives a de-
by which the probabilities are adjusted with each iteration is     crease in probability. These conditions can be expected to
now proportional to the size of the group itself, instead of the   alternate as the conditional probabilities P (Y |S) converge.
size of the opposite group. In experiments, this yields a great    Iteration continues until ρd is close to zero. The smax and
performance improvement, especially where the distribution         smin groups are determined as in the previous section.
of samples over S is very imbalanced.                                 This routine disregards the number of positive labels the
                                                                   model produces, while Algorithm 1 attempts to keep that
Enforcing Differential Fairness                                    number close to the number of positive labels in the train-
An alternative measure of fairness we explore is differential      ing data. This allows it to avoid situations where a single,
fairness, as given in (Foulds et al. 2020).                        non-privileged sub-group with small probability would re-
Definition 4. A classifier is ϵ-differentially fair if:            quire the probabilities of the privileged groups to be reduced
                                                                   significantly. In such cases, other non-privileged sub-groups
                 P (ŷ|s)                                          might maintain much higher probabilities, therefore giving
           e−ϵ ≤            ≤ eϵ ∀ s, s′ ∈ S, ŷ ∈ Y       (8)
                 P (ŷ|s′ )                                        a poor ϵ-score. An further difference is the proportion by
   The (smoothed) empirical differential fairness score, from          5
the empirical counts in the data, assuming a binary label, is:           Note that this definition produces noisier estimates for sub-
                                                                   groups with fewer members. (Morina et al. 2019) shows that as the
                                                                   dataset grows, the given estimate converges to the true value, and
         N (ŷ, s) + α N (s′ ) + β
e−ϵ ≤                               ≤ eϵ ∀ s, s′ ∈ S, ŷ ∈ Y       that this happens regardless of the chosen smoothing parameters.
          N (s) + β N (ŷ, s′ ) + α                                However, for small or imbalanced datasets, more robust estimation
                                                           (9)     methods should be used.




                                                                                                                              59
Algorithm 2: Pseudocode for a probability-balancing routine          indicated after its name, e.g. Income-Race-Sex is the
to enforce DF parity                                                 Income task using race and sex as the sensitive features.
 1: Calculate the ratios ρd , ρu empirically from the pre-           To best capture intersectional fairness when using multiple
    dicted classes by the current model, store smax , smin           sensitive features, we follow the approach from (Foulds et al.
 2: while ρd > disc0 do                                              2020) and define each group s as a tuple of the sub-groups
 3:   if ρu ≤ ρd then                                                of each sensitive feature that each sample belongs to.
 4:      N (y = 0, smin ) − = ∆ ∗ N (y = 0, smin )                   First Experiment This experiment compares NNB’s per-
 5:      N (y = 1, smin ) + = ∆ ∗ N (y = 1, smin )                   formance with other algorithms. The comparison includes
 6:   else                                                           ”vanilla” models as baselines for performance, and several
 7:      N (y = 0, smax ) + = ∆ ∗ N (y = 0, smax )                   group-fairness-aware algorithms that have a similar focus to
 8:      N (y = 1, smax ) − = ∆ ∗ N (y = 1, smax )                   NNB - ensuring non-discrimination across protected groups
 9:   end if                                                         by optimising metrics such as statistical parity or disparate
10:   Recalculate P (Y |S), ρd , ρu , smax , smin                    impact. Specifically, we consider the following:
11: end while
                                                                      • GaussianNB, DecisionTree, LR, SVM: scikit-
                                                                        Learn’s Gaussian naive Bayes, Decision Trees, Logistic
                                                                        Regression, and SVM.
which each Ny,s is modified grows/decreases exponentially.
In experiments, this allows the routine escape local minima           • Feldman-DT, Feldman-NB: A pre-processing algo-
that occur during the adjustment of P (Y |S) and lead to in-            rithm that aims to remove disparate impact. It equalises
efficiency. This routine does, however, offer a theoretical ac-         the marginal distributions of the subsets of each attribute
curacy trade-off compared to Algorithm 1, which we inves-               with each sensitive value (Feldman et al. 2015). The re-
tigate in the following section.                                        sulting ”repaired” data is then used to train scikit-Learn
   Finally, note that all the above probability-balancing rou-          classifiers - Decision Trees (DT) and Gaussian naive
tines (including Calders and Verwer’s original one) are                 Bayes (NB).
based around the assumption that the distribution of labels           • Kamishima: An in-processing method that introduces a
over the sensitive feature(s) in the training set is reflective of      regularisation term to logistic regression to enforce inde-
the test setting. This assumption is not unique to this model           pendence of labels from the sensitive feature (Kamishima
(see (Agarwal et al. 2018; Hardt, Price, and Srebro 2016)),             et al. 2012).
and under it, we can conclude that minimising the given fair-         • ZafarAccuracy, ZafarFairness: An in-
ness measure on the training set generalises to the test data           processing algorithm that applies fairness constraints
(Singh et al. 2021).                                                    to convex margin-based classifiers (Zafar et al. 2017) .
                                                                        Specifically, we test two variations of a modified logistic
               3    Experimental Results                                regression classifier: The first maximises accuracy
Setup                                                                   subject to fairness (disparate impact) constraints, while
                                                                        the latter prioritises removing disparate impact.
We implement NNB in Python within the scikit-Learn
                                                                      • 2NB: Calders and Verwer’s original algorithm, using the
framework, using Gaussian naive Bayes as the sub-
                                                                        same GaussianNB sub-estimator as NNB.
estimator. We then evaluate its performance in two experi-
ments.                                                                • NNB-Parity, NNB-DF: N-naive-Bayes tuned to sat-
   For both experiments, we use real-world data from the US             isfy statistical parity using Algorithm 1, and DF-parity
Census Bureau6 . (Ding et al. 2021) define several classifica-          using Algorithm 2.
tion tasks on this data, each involving a sub-set of the total          For the comparison we use the benchmark provided by
features available. We consider two:                                 (Friedler et al. 2019). The fairness-aware algorithms are
 • Income: Predict whether an individual’s income is                 tuned via grid-search to optimise accuracy. The performance
   above $50,000. The data for this problem is filtered so           of the algorithms is then measured over ten random train-test
   that it serves as a comparable replacement to the well-           splits of the data.
   known UCI Adult dataset.                                          Second Experiment This experiment demonstrates how
 • Employment: Predict whether an individual is em-                  NNB performs in finer detail. We consider GaussianNB,
   ployed                                                            NNB-Parity, and NNB-DF as before, and we further in-
   The details of which features are included in each task and       clude 2NB, the original two-naive-Bayes algorithm imple-
what filtering takes place can be found in the paper (Ding           mented identically to NNB. Finally, we include Perfect
et al. 2021) and the associated page on GitHub7 . To eval-           as a secondary baseline, to illustrate the scores that would
uate NNB we use data from the 2018 census in the state               be achieved by a perfect classifier.
of California. The sensitive feature(s) used in each task are           To evaluate the performance of the above algorithms, we
                                                                     note the mean and variance of the following measures over
   6
     https://www.census.gov/programs-                                10 random train-test splits: accuracy, AUC, disparate im-
surveys/acs/microdata/documentation.html                             pact score (mean of the DI between all privileged and non-
   7
     https://github.com/zykls/folktables                             privileged groups), statistical parity score (as defined in 2),




                                                                                                                             60
        Figure 1: Scatter plots of accuracy vs. disparate impact for Income-Race and vs. ϵ-score for Income-Race-Sex


DF-ϵ (as defined in 4), DF-bias amplification score (as de-         On Employment-Race all naive Bayes models achieve
fined in 5). We also compare the resultant distribution of la-   similar accuracy, while DT and LR-based models rank
bels over groups of S on a single random train-test split.       higher, and SVM the highest. The same can be observed for
                                                                 Employment-Race-Sex, and for both tasks NNB-DF again
Results                                                          gives the ϵ-scores closest to zero.

First Experiment Figure 1 gives the accuracy vs. the             Second Experiment Table 2 gives the scores achieved
disparate impact and DF-ϵ scores on the Income-Race              on the Income-Race task, and Table 3 gives the
and Income-Race-Sex tasks. Figure 2 shows the same for           same Employment-Race-Sex. On Income-Race,
Employment-Race and Employment-Race-Sex. It can be               both NNB models gave an improved parity score compared
seen that on Income-Race, NNB results in a higher DI score       to the perfect classifier and GaussianNB. NNB and 2NB
than 2NB and has often over-favoured non-privileged groups       also gave improved disparate impact scores over the baseline
causing a score > 1. Its accuracy is on-par with 2NB and         models, but 2NB under-corrected while the NNB models
the baseline naive Bayes, DT, and LR models. Feldman’s al-       gave a score > 1 indicating they favoured the non-privileged
gorithm with Decision Trees results similar disparate impact     groups over the privileged group.
score in some splits, but lower accuracy. The same is true for      NNB-Parity and NNB-DF gave similar disparate im-
the DF-ϵ score on this task. On Income-Race-Sex, NNB-DF          pact scores, but the former gave higher accuracy while the
beats out all other algorithms in achieving DI ∼ 1, however      latter produced a narrower range of positive label propor-
NNB-Parity has higher accuracy than both NNB-DF and              tions, and thus better parity, ϵ, and DF-bias amplification
naive Bayes. NNB-DF is also the most successful at min-          scores. The evident accuracy trade-off is more pronounced
imising the ϵ-score for this task, though again this comes at    in the latter task, with NNB-Parity achieving an accuracy
the cost of lower accuracy than the baseline model.              of 0.7445 ± 0.00, and NNB-DF achieving 0.7199 ± 0.00.




                                                                                                                       61
  Figure 2: Scatter plots of accuracy vs. disparate impact for Employment-Race and vs. ϵ-score for Employment-Race-Sex


   On Employment-Race-Sex, NNB-DF outperformed                 Statistical Parity as a Fairness Criterion Statistical par-
NNB-Parity on all scores. This was also the case for           ity stands opposed to the (aggregate) accuracy of a classifier,
Employment-Race, where both models had similar ac-             except in degenerate cases where the data is already fair, so
curacy but NNB-DF displayed less over-correction in its        it is recommended that a balance between the two is pursued
disparate impact score (1.0336 ± 0.0001 versus 1.2760 ±        (Hertweck, Heitz, and Loi 2021). This also applies to the ex-
0.0002), in addition to the expected improvement in ϵ-score    tended, but still parity-based, DF measure that was explored
(0.1068 ± 0.001 versus 0.3434 ± 0.0001). This suggests the     in Section 2. In their worldview-based analysis, Yeom and
DF balancing routine is better suited for the Employment       Tschantz caution us that even under WAE, blind enforce-
task than the parity-based routine.                            ment of statistical parity can introduce new discrimination
                                                               into the system (Yeom and Tschantz 2021). Thus, users must
                    4    Discussion                            be aware of the ethical implications of using parity as a core
                                                               fairness constraint, the possible impact it may have on in-
In this work we presented an extension of the two-naive-       dividuals, and the moral objections these individuals may
Bayes algorithm, adapting it to suit datasets with multi-      justifiably raise.
ple, polyvalent sensitive features. We applied the proposed
N-naive-Bayes structure to intersectionality and differen-
tial fairness by giving an alternative probability-balancing      We recommend further reading on the advantages and dis-
routine. Our experiments on real-world datasets yielded        advantages of group fairness in general (Räz 2021; Dwork
favourable results and demonstrated the effectiveness and      et al. 2012; Heidari et al. 2019), as well as parity specifically
the differences between the parity and DF-based approaches.    (Hertweck, Heitz, and Loi 2021; Yeom and Tschantz 2021),
   We conclude by laying out key considerations users          so users can make informed decisions on how to apply sta-
should take into account before using N-naive-Bayes:           tistical parity and N-naive-Bayes to their application.




                                                                                                                        62
                       AUC            Accuracy              DI             Parity             DF-ϵ              DF-amp
 GaussianNB        0.8270 ± 0.00    0.7503 ± 0.00    0.6304 ± 0.0001   0.4222 ± 0.0000   1.4100 ± 0.0012    0.4680 ± 0.0045
 2NB               0.8223 ± 0.00    0.7577 ± 0.00    0.8930 ± 0.0013   0.3606 ± 0.0000   0.9774 ± 0.0016    0.0353 ± 0.0059
 NNB-Parity        0.8114 ± 0.00    0.7480 ± 0.00    1.0810 ± 0.0006   0.1984 ± 0.0005   0.4580 ± 0.0045    −0.4840 ± 0.0041
 NNB-DF            0.8138 ± 0.00    0.7380 ± 0.00    1.0636 ± 0.0007   0.1530 ± 0.0008   0.3112 ± 0.0048    −0.6308 ± 0.0035
 Perfect           1.0000 ± 0.00    1.0000 ± 0.00    0.6975 ± 0.0005   0.2950 ± 0.0001   0.9420 ± 0.0048    0.0000 ± 0.0000

                            Table 2: Scores Achieved on Income with Race as the Sensitive Feature

                       AUC            Accuracy              DI             Parity             DF-ϵ              DF-amp
 GaussianNB        0.8159 ± 0.00    0.7273 ± 0.00    1.0228 ± 0.0001   0.3000 ± 0.0001   0.4994 ± 0.0003    0.0922 ± 0.0016
 2NB               0.8112 ± 0.00    0.7202 ± 0.00    0.9352 ± 0.0001   0.2951 ± 0.0001   0.4818 ± 0.0002    0.0746 ± 0.0015
 NNB-Parity        0.7820 ± 0.00    0.7241 ± 0.00    1.2990 ± 0.0004   0.2478 ± 0.0007   0.3971 ± 0.0013    −0.0101 ± 0.0005
 NNB-DF            0.7909 ± 0.00    0.7251 ± 0.00    1.0601 ± 0.0002   0.1272 ± 0.0009   0.1840 ± 0.0018    −0.2232 ± 0.0011
 Perfect           1.0000 ± 0.00    1.0000 ± 0.00    0.8643 ± 0.0001   0.1782 ± 0.0002   0.4072 ± 0.0014    0.0000 ± 0.0000

                     Table 3: Scores Achieved on Employment with Race and Sex as the Sensitive Features


Limitations of NNB N-naive-Bayes (as with two-naive-                                      References
Bayes) has inherent limitations. The algorithm does not au-        Agarwal, A.; Beygelzimer, A.; Dudik, M.; Langford, J.; and
tomatically make a classification task fair when it is ap-         Wallach, H. 2018. A Reductions Approach to Fair Classifi-
plied. This is only considered to be possible by doing exten-      cation. In Dy, J.; and Krause, A., eds., Proceedings of the
sive domain-specific investigation (Hardt, Price, and Srebro       35th International Conference on Machine Learning, vol-
2016). Rather, the algorithm introduces a form of affirmative      ume 80 of Proceedings of Machine Learning Research, 60–
action to the task, increasing and decreasing the likelihood       69. Stockholm, Sweden: PMLR.
of different groups receiving a positive label in an attempt to    Anderson, E. 2003. Integration, Affirmative Action, and
satisfy the given parity constraint. This intentional manipu-      Strict Scrutiny. New York University Law Review, 77(5):
lation of the original distribution over the data can be done      1195–1271.
to correct for structural biases in the data, for the purposes
of compliance with regulations, or even as part of an effort       Awasthi, P.; Cortes, C.; Mansour, Y.; and Mohri, M.
to counteract historical inequalities.                             2020. Beyond Individual and Group Fairness. CoRR,
                                                                   abs/2008.09490.
                                                                   Barocas, S.; Hardt, M.; and Narayanan, A. 2019. Fair-
   Users should always consider the implications of estimat-       ness and Machine Learning. fairmlbook.org. http://www.
ing probability distributions for each group separately (as        fairmlbook.org.
is done at the beginning of the training stage), as well as
the mechanism behind any post-facto probability tuning they        Blum, A.; Gunasekar, S.; Lykouris, T.; and Srebro, N.
decide on. Further, users should understand the implications       2018. On Preserving Non-Discrimination When Combin-
of affirmative action, its downstream effects, and ensure it       ing Expert Advice. In Proceedings of the 32nd Interna-
is appropriate to their application. As a starting point for       tional Conference on Neural Information Processing Sys-
further reading, see (Dwork et al. 2012; Kannan, Roth, and         tems, NIPS’18, 8386–8397. Red Hook, NY, USA: Curran
Ziani 2019). Sociological and legal works such as (Kalev,          Associates Inc.
Dobbin, and Kelly 2006; Anderson 2003) are also recom-             Calders, T.; and Verwer, S. 2010. Three naive Bayes ap-
mended.                                                            proaches for discrimination-free classification. Data Mining
                                                                   and Knowledge Discovery, 21(2): 277–292.
   Finally, the explicit choice of sensitive features to con-      Ding, F.; Hardt, M.; Miller, J.; and Schmidt, L. 2021. Retir-
sider when enforcing statistical parity is a simplification of     ing Adult: New Datasets for Fair Machine Learning. CoRR,
the real world and should be done carefully. One should con-       abs/2108.04884.
sider the ontology behind observed values in the dataset:          Donini, M.; Oneto, L.; Ben-David, S.; Shawe-Taylor, J.;
race, for example, has varying definitions, each of which          and Pontil, M. 2018. Empirical Risk Minimization under
comes with its own assumptions. Further, identifying groups        Fairness Constraints. In Proceedings of the 32nd Interna-
in the data using a set of observable qualities, whatever those    tional Conference on Neural Information Processing Sys-
may be, also carries implicit assumptions about how all the        tems, NIPS’18, 2796–2806. Red Hook, NY, USA: Curran
factors involved interact with each other and the validity of      Associates Inc.
decomposing them into discrete features (Barocas, Hardt,           Dwork, C.; Hardt, M.; Pitassi, T.; Reingold, O.; and Zemel,
and Narayanan 2019, Ch. 5).                                        R. 2012. Fairness through Awareness. In Proceedings of




                                                                                                                         63
the 3rd Innovations in Theoretical Computer Science Con-            Kamishima, T.; Akaho, S.; Asoh, H.; and Sakuma, J. 2013.
ference, ITCS ’12, 214–226. New York, NY, USA: Associa-             The Independence of Fairness-Aware Classifiers. In Pro-
tion for Computing Machinery. ISBN 9781450311151.                   ceedings of the 2013 IEEE 13th International Conference
Feldman, M.; Friedler, S. A.; Moeller, J.; Scheidegger, C.;         on Data Mining Workshops, ICDMW ’13, 849–858. USA:
and Venkatasubramanian, S. 2015. Certifying and Remov-              IEEE Computer Society. ISBN 9781479931422.
ing Disparate Impact. In Proceedings of the 21th ACM                Kannan, S.; Roth, A.; and Ziani, J. 2019. Downstream Ef-
SIGKDD International Conference on Knowledge Discov-                fects of Affirmative Action. In Proceedings of the Confer-
ery and Data Mining, KDD ’15, 259–268. New York,                    ence on Fairness, Accountability, and Transparency, FAT*
NY, USA: Association for Computing Machinery. ISBN                  ’19, 240–248. New York, NY, USA: Association for Com-
9781450336642.                                                      puting Machinery. ISBN 9781450361255.
Feng, X.; Li, S.; Yuan, C.; Zeng, P.; and Sun, Y. 2018.             Kearns, M.; Neel, S.; Roth, A.; and Wu, Z. S. 2018. Pre-
Prediction of Slope Stability using Naive Bayes Classifier.         venting Fairness Gerrymandering: Auditing and Learning
KSCE Journal of Civil Engineering, 22(3): 941–950.                  for Subgroup Fairness. In Dy, J.; and Krause, A., eds., Pro-
                                                                    ceedings of the 35th International Conference on Machine
Foulds, J. R.; Islam, R.; Keya, K. N.; and Pan, S. 2020. An
                                                                    Learning, volume 80 of Proceedings of Machine Learn-
Intersectional Definition of Fairness. In 2020 IEEE 36th In-
                                                                    ing Research, 2564–2572. Stockholmsmassan, Stockholm,
ternational Conference on Data Engineering (ICDE), 1918–
                                                                    Sweden: PMLR.
1921. Dallas, Texas, USA: IEEE.
                                                                    Kleinberg, J.; Mullainathan, S.; and Raghavan, M. 2017. In-
Friedler, S. A.; Scheidegger, C.; and Venkatasubramanian,           herent Trade-Offs in the Fair Determination of Risk Scores.
S. 2016. On the (im)possibility of fairness. CoRR,                  In Papadimitriou, C. H., ed., 8th Innovations in Theoretical
abs/1609.07236: 16.                                                 Computer Science Conference (ITCS 2017), volume 67 of
Friedler, S. A.; Scheidegger, C.; Venkatasubramanian, S.;           Leibniz International Proceedings in Informatics (LIPIcs),
Choudhary, S.; Hamilton, E. P.; and Roth, D. 2019. A Com-           43:1–43:23. Germany: Schloss Dagstuhl–Leibniz-Zentrum
parative Study of Fairness-Enhancing Interventions in Ma-           fuer Informatik. ISBN 978-3-95977-029-3.
chine Learning. In Proceedings of the Conference on Fair-           Mhasawade, V.; and Chunara, R. 2021. Causal Multi-Level
ness, Accountability, and Transparency, FAT* ’19, 329–338.          Fairness. In Proceedings of the 2021 AAAI/ACM Conference
New York, NY, USA: Association for Computing Machin-                on AI, Ethics, and Society, AIES ’21, 784–794. New York,
ery. ISBN 9781450361255.                                            NY, USA: Association for Computing Machinery. ISBN
Hardt, M.; Price, E.; and Srebro, N. 2016. Equality of Op-          9781450384735.
portunity in Supervised Learning. In Proceedings of the 30th        Morina, G.; Oliinyk, V.; Waton, J.; Marusic, I.; and Geor-
International Conference on Neural Information Processing           gatzis, K. 2019. Auditing and Achieving Intersectional Fair-
Systems, NIPS’16, 3323–3331. Red Hook, NY, USA: Cur-                ness in Classification Problems. arXiv:1911.01468.
ran Associates Inc. ISBN 9781510838819.                             Niazi, K. A. K.; Akhtar, W.; Khan, H. A.; Yang, Y.; and
Heidari, H.; Loi, M.; Gummadi, K. P.; and Krause, A.                Athar, S. 2019. Hotspot diagnosis for solar photovoltaic
2019. A Moral Framework for Understanding Fair ML                   modules using a Naive Bayes classifier. Solar Energy, 190:
through Economic Models of Equality of Opportunity. In              34–43.
Proceedings of the Conference on Fairness, Accountabil-             Oneto, L.; Donini, M.; and Pontil, M. 2020. General Fair
ity, and Transparency, FAT* ’19, 181–190. New York,                 Empirical Risk Minimization. In 2020 International Joint
NY, USA: Association for Computing Machinery. ISBN                  Conference on Neural Networks (IJCNN), 1–8. Glasgow,
9781450361255.                                                      United Kingdom: IEEE.
Hertweck, C.; Heitz, C.; and Loi, M. 2021. On the Moral             Räz, T. 2021. Group Fairness: Independence Revisited. In
Justification of Statistical Parity. In Proceedings of the 2021     Proceedings of the 2021 ACM Conference on Fairness, Ac-
ACM Conference on Fairness, Accountability, and Trans-              countability, and Transparency, FAccT ’21, 129–137. New
parency, FAccT ’21, 747–757. New York, NY, USA: Asso-               York, NY, USA: Association for Computing Machinery.
ciation for Computing Machinery. ISBN 9781450383097.                ISBN 9781450383097.
Jiang, L. 2011. Random one-dependence estimators. Pattern           Ritov, Y.; Sun, Y.; and Zhao, R. 2017. On conditional par-
Recognition Letters, 32(3): 532–539.                                ity as a notion of non-discrimination in machine learning.
Kalev, A.; Dobbin, F.; and Kelly, E. 2006. Best Practices or        arXiv:1706.08519.
Best Guesses? Assessing the Efficacy of Corporate Affirma-          Singh, H.; Singh, R.; Mhasawade, V.; and Chunara, R. 2021.
tive Action and Diversity Policies. American Sociological           Fairness Violations and Mitigation under Covariate Shift.
Review, 71(4): 589–617.                                             In Proceedings of the 2021 ACM Conference on Fairness,
Kamishima, T.; Akaho, S.; Asoh, H.; and Sakuma, J. 2012.            Accountability, and Transparency, FAccT ’21, 3–13. New
Fairness-Aware Classifier with Prejudice Remover Regular-           York, NY, USA: Association for Computing Machinery.
izer. In Flach, P. A.; De Bie, T.; and Cristianini, N., eds., Ma-   ISBN 9781450383097.
chine Learning and Knowledge Discovery in Databases, 35–            Valdiviezo-Diaz, P.; Ortega, F.; Cobos, E.; and Lara-
50. Berlin, Heidelberg: Springer Berlin Heidelberg. ISBN            Cabrera, R. 2019. A Collaborative Filtering Approach Based
978-3-642-33486-3.                                                  on Naı̈ve Bayes Classifier. IEEE Access, 7: 108581–108592.




                                                                                                                         64
Yeom, S.; and Tschantz, M. C. 2021. Avoiding Dispar-
ity Amplification under Different Worldviews. In Proceed-
ings of the 2021 ACM Conference on Fairness, Account-
ability, and Transparency, FAccT ’21, 273–283. New York,
NY, USA: Association for Computing Machinery. ISBN
9781450383097.
Zafar, M. B.; Valera, I.; Rogriguez, M. G.; and Gummadi,
K. P. 2017. Fairness Constraints: Mechanisms for Fair Clas-
sification. In Singh, A.; and Zhu, J., eds., Proceedings of the
20th International Conference on Artificial Intelligence and
Statistics, volume 54 of Proceedings of Machine Learning
Research, 962–970. Ft. Lauderdale, FL, USA: PMLR.
Zhao, J.; Wang, T.; Yatskar, M.; Ordonez, V.; and Chang,
K. 2017. Men Also Like Shopping: Reducing Gender
Bias Amplification using Corpus-level Constraints. CoRR,
abs/1707.09457.




                                                                  65