Techno Blender
Digitally Yours.

What are the fairness implications of encoding categorical protected attributes? | by Carlos Mougan | May, 2023

0 27


Exploring the Impact of Encoding Protected Attributes on Fairness in ML

Lady Justice at dawn from Unsplash

We will explore the world of categorical attribute encoding and its implications for machine learning models in terms of accuracy and fairness. Categorical attributes, such as country of birth or ethnicity, play a crucial role in determining the presence of sensitive information in data. However, many machine learning algorithms struggle to directly process categorical attributes, necessitating the use of encoding methods to transform them into numerical features that can be utilized by the models. Furthermore, we study the implication of intersectional fairness engineering.

This blog contains a summary of our AI, Ethics, and Society (AIES’23) conference paper Fairness implications of encoding protected categorical attributes, [link] that is a collaborative work between Carlos Mougan, Jose M. Alvarez, Salvatore Ruggieri, and Steffen Staab. Please cite as:

@inproceedings{fairEncoder,
author = {Mougan, Carlos and Alvarez, Jose M. and Ruggieri, Salvatore and Staab, Steffen},
title = {Fairness Implications of Encoding Protected Categorical Attributes},
year = {2023},
url = {https://arxiv.org/abs/2201.11358},
booktitle = {Proceedings of the 2023 AAAI/ACM Conference on AI, Ethics, and Society},
location = {Montreal, Canada},
series = {AIES '23}
}

Sensitive attributes are central to fairness and so are their handling throughout the machine learning pipeline. Many machine learning algorithms require categorical attributes to be suitably encoded as numerical data before being fed to algorithms.

What are the implications of encoding categorical protected attributes?

In previous fairness works, the presence of sensitive attributes is assumed, and so is their feature encoding. Given the range of available categorical encoding methods and the fact that they often must deal with sensitive attributes, we believe this first study on the subject to be highly relevant to the fair machine learning community.

Types of induced bias

We investigate two types of biases that can arise from these encoding methods: irreducible bias and reducible bias:

  • Irreducible bias: It refers to (direct) group discrimination arising from the categorization of groups into labels: more data about the compared groups do not reduce this type of bias. In the COMPAS dataset, criminal ethnicity was paramount when determining recidivism scores; the numerical encoding of large ethnicity groups such as African-Americans or Caucasians may lead to discrimination, which is an unfair effect coming from the irreducible bias.
  • Reducible bias: arises due to the variance when encoding groups that have a small statistical representation, sometimes even only very few instances of the group. Reducible bias can be found and introduced when encoding the ethnicity category Arabic, which is rarely represented in the data, provoking a large sampling variance that ends in an almost random and unrealistic encoding.

Encoding methods

Handling categorical features is a common problem in machine learning, given that many algorithms need to be fed with numerical data. We delve into the comparison of two well-known encoding methods: one-hot encoding and target encoding.

  • One hot encoding: Is the most established encoding method for categorical features, is also the default method within the fairness literature. This encoding method constructs orthogonal and equidistant vectors for each category.
One Hot Encoding over illustrative example. Image by author
  • Target Encoding: categorical features are replaced with the mean target value of each respective category. This technique handles high cardinality categorical data and categories are ordered. The main drawback of target encoding appears when categories with few samples are replaced by values close to the desired target. This introduces bias to the model as it over-trusts the target encoded feature and makes the model prone to overfitting and reducible bias.

Furthermore, this type of encoding allows for regularization. In this paper we study two types of regularization (in the blog we only study Gaussian)

Target Encoding over illustrative example. Image by author

For predictive performance we use AUC and for fairness metrics. Between the reference group (r) and the group we want to compare (i). Z is the protected attribute, and \hat{Y} is the model predictions.

Demographic Parity

The difference between favorable outcomes received by the unprivileged group and privileged group

Equal Opportunity Fairness

Ensuring fair opportunity instead of raw outcomes. The value is the difference in the
True Positive Rate (TPR) between the protected group and
the reference group

Average Absolute Odds

The sum of the absolute differences between the True Positive Rates and the False Positive Rates of the unprivileged group plus the same ratio for the privileged group
Figure: Comparing OHE and target encoding regularization (Gaussian noise) for the Logistic Regression over COMPAS dataset. Red dots regard different regularization parameters: the darker the red the higher the regularization. The blue dot regards the one-hot encoding. Image by author.
Impact of the Gaussian noise regularization parameter $\lambda$ on performance and fairness metrics over the test set of the COMPAS dataset using a Logistic Regression with L1 penalty. In the left image the AUC of the all the protected groups over the regularization hyperparameter. On the right, the equal opportunity fairness, demograpic parity and average absolute oods variation throughout the regularization hyperparameter. Image by author

In the experiment, we showed that the most used categorical encoding method in the fair machine learning literature, one-hot encoding, discriminates more in terms of equal opportunity fairness than target encoding. However, target encoding shows promising results. Target encoding using Gaussian regularization show improvements under the presence of both types of biases, with the risk of a noticeable loss of model performance in the case of over-parametrization.

Intersectional Fairness

In the quest for fairness in machine learning, it is essential to recognize the complex interplay of attributes and their impact on discrimination. This section delves into the effects of encoding categorical attributes on intersectional fairness, focusing on insights gained from the COMPAS dataset. We put forth hypotheses concerning the potential degradation of fairness through attribute engineering, the propensity for categorical encoding to increase discrimination, and the efficacy of regularization techniques in mitigating intersectional biases.

To explore the effects of encodings on intersectional fairness, we analyze the concatenated “Ethnic” and “Marital Status” attributes in the COMPAS dataset. By selecting the “Caucasian Married” group as the reference, we compare the maximum fairness violation across all groups. To facilitate comprehension, we utilize the generalized linear model from the previous section and emphasize the Equal Opportunity Fairness metric, which aligns with the behavior of other fairness metrics.

Equal opportunity fairness implications of encoding categorical protected attributes and their regularization effects on the Compas Dataset. Horizontal lines are the base lines where the protected attribute is not included in the training data. Regularized target encoding does not harm fairness metrics but it can improve predictive performance on this dataset. Image by author.

The above figure visually demonstrates how attribute concatenation creates intersectional attributes and exacerbates fairness violations, providing empirical support for our first hypothesis. Remarkably, even when the protected attributes are not encoded (represented by horizontal lines), the maximum fairness violation increases substantially from 0.015 for “Ethnic” or 0.08 for “Marital Status” to 0.16 for the intersectional attribute. This finding substantiates Kimberle Crenshaw’s seminal work in 1958, which shed light on how different forms of oppression intersect and compound discrimination for marginalized groups.

Moreover, our second hypothesis is corroborated by observing that both encoding techniques result in higher equal opportunity violations compared to not encoding the protected attribute. This highlights the role of encoding in amplifying discrimination. However, there is a glimmer of hope: through the regularization of target encoding, fairness can be enhanced. This result aligns with our theoretical understanding, as attribute concatenation can worsen fairness by increasing both irreducible and reducible biases.

Our research highlights the significant role of categorical attribute encoding in balancing model accuracy and fairness in machine learning. We have identified two types of biases, irreducible and reducible, that can arise from encoding categorical attributes.

Through theoretical analysis and empirical experiments, we find that one-hot encoding tends to exhibit more discrimination compared to target encoding. However, promising results are observed with regularized target encoding, which shows potential for improving fairness while maintaining acceptable model performance.

We emphasize the importance of considering the implications of encoding categorical protected attributes, as slight modifications in the encoding approach can lead to fairness improvements without significant sacrifices in predictive accuracy.

Nonetheless, it is essential to acknowledge the limitations of our study and the need for further exploration. Our open-source resources ensure the reproducibility of our results.

In recent years we have seen algorithmic methods aiming to improve fairness in data-driven systems from many perspectives: data collection, pre-processing, in-processing, and post-processing steps. In this work, we have focused on how the encoding of categorical attributes (a common pre-processing step) can reconcile model quality and fairness.

A common underpinning of much of the work in fair ML is the assumption that trade-offs between equity and accuracy may necessitate complex methods or difficult policy choices [Rodolfa et al.]

Since target encoding with regularization is not only easy to perform but also does not require significant changes to the machine learning models, it can be explored in the future as a suitable complementary for in-processing methods in fair machine learning.

We encourage industry practitioners to consider the implications of encoding categorical protected attributes. With slight changes in the encoding approach, improvements in fairness can be achieved without significant detriment to predictive performance. However, it is essential to understand that the usage of fair AI methods does not guarantee the fairness of complex socio-technical systems.

Limitations: This work aims to show what are some of the implications of encoding categorical protected attributes at any moment it should be understood as if in any situation encoding categorical protected attributes won’t increase fairness metrics, we advocate that considering the effects of encoding regularization along the fairness axis too, not only on the predictive performance axis. The usage of fair-AI methods does not necessarily guarantee the fairness of AI-based complex socio-technical systems.

Acknowledgements

This work has received funding from the European Union’s Horizon 2020 research and innovation program under Marie Sklodowska-Curie Actions (grant agreement number 860630) for the project ‘’NoBIAS — Artificial Intelligence without Bias’’

Disclaimer

This work reflects only the authors’ views and the European Research Executive Agency (REA) is not responsible for any use that may be made of the information it contains.

Cite

@inproceedings{fairEncoder,
author = {Mougan, Carlos and Alvarez, Jose M. and Ruggieri, Salvatore and Staab, Steffen},
title = {Fairness Implications of Encoding Protected Categorical Attributes},
year = {2023},
url = {https://arxiv.org/abs/2201.11358},
booktitle = {Proceedings of the 2023 AAAI/ACM Conference on AI, Ethics, and Society},
location = {Montreal, Canada},
series = {AIES '23}
}




Exploring the Impact of Encoding Protected Attributes on Fairness in ML

Lady Justice at dawn from Unsplash

We will explore the world of categorical attribute encoding and its implications for machine learning models in terms of accuracy and fairness. Categorical attributes, such as country of birth or ethnicity, play a crucial role in determining the presence of sensitive information in data. However, many machine learning algorithms struggle to directly process categorical attributes, necessitating the use of encoding methods to transform them into numerical features that can be utilized by the models. Furthermore, we study the implication of intersectional fairness engineering.

This blog contains a summary of our AI, Ethics, and Society (AIES’23) conference paper Fairness implications of encoding protected categorical attributes, [link] that is a collaborative work between Carlos Mougan, Jose M. Alvarez, Salvatore Ruggieri, and Steffen Staab. Please cite as:

@inproceedings{fairEncoder,
author = {Mougan, Carlos and Alvarez, Jose M. and Ruggieri, Salvatore and Staab, Steffen},
title = {Fairness Implications of Encoding Protected Categorical Attributes},
year = {2023},
url = {https://arxiv.org/abs/2201.11358},
booktitle = {Proceedings of the 2023 AAAI/ACM Conference on AI, Ethics, and Society},
location = {Montreal, Canada},
series = {AIES '23}
}

Sensitive attributes are central to fairness and so are their handling throughout the machine learning pipeline. Many machine learning algorithms require categorical attributes to be suitably encoded as numerical data before being fed to algorithms.

What are the implications of encoding categorical protected attributes?

In previous fairness works, the presence of sensitive attributes is assumed, and so is their feature encoding. Given the range of available categorical encoding methods and the fact that they often must deal with sensitive attributes, we believe this first study on the subject to be highly relevant to the fair machine learning community.

Types of induced bias

We investigate two types of biases that can arise from these encoding methods: irreducible bias and reducible bias:

  • Irreducible bias: It refers to (direct) group discrimination arising from the categorization of groups into labels: more data about the compared groups do not reduce this type of bias. In the COMPAS dataset, criminal ethnicity was paramount when determining recidivism scores; the numerical encoding of large ethnicity groups such as African-Americans or Caucasians may lead to discrimination, which is an unfair effect coming from the irreducible bias.
  • Reducible bias: arises due to the variance when encoding groups that have a small statistical representation, sometimes even only very few instances of the group. Reducible bias can be found and introduced when encoding the ethnicity category Arabic, which is rarely represented in the data, provoking a large sampling variance that ends in an almost random and unrealistic encoding.

Encoding methods

Handling categorical features is a common problem in machine learning, given that many algorithms need to be fed with numerical data. We delve into the comparison of two well-known encoding methods: one-hot encoding and target encoding.

  • One hot encoding: Is the most established encoding method for categorical features, is also the default method within the fairness literature. This encoding method constructs orthogonal and equidistant vectors for each category.
One Hot Encoding over illustrative example. Image by author
  • Target Encoding: categorical features are replaced with the mean target value of each respective category. This technique handles high cardinality categorical data and categories are ordered. The main drawback of target encoding appears when categories with few samples are replaced by values close to the desired target. This introduces bias to the model as it over-trusts the target encoded feature and makes the model prone to overfitting and reducible bias.

Furthermore, this type of encoding allows for regularization. In this paper we study two types of regularization (in the blog we only study Gaussian)

Target Encoding over illustrative example. Image by author

For predictive performance we use AUC and for fairness metrics. Between the reference group (r) and the group we want to compare (i). Z is the protected attribute, and \hat{Y} is the model predictions.

Demographic Parity

The difference between favorable outcomes received by the unprivileged group and privileged group

Equal Opportunity Fairness

Ensuring fair opportunity instead of raw outcomes. The value is the difference in the
True Positive Rate (TPR) between the protected group and
the reference group

Average Absolute Odds

The sum of the absolute differences between the True Positive Rates and the False Positive Rates of the unprivileged group plus the same ratio for the privileged group
Figure: Comparing OHE and target encoding regularization (Gaussian noise) for the Logistic Regression over COMPAS dataset. Red dots regard different regularization parameters: the darker the red the higher the regularization. The blue dot regards the one-hot encoding. Image by author.
Impact of the Gaussian noise regularization parameter $\lambda$ on performance and fairness metrics over the test set of the COMPAS dataset using a Logistic Regression with L1 penalty. In the left image the AUC of the all the protected groups over the regularization hyperparameter. On the right, the equal opportunity fairness, demograpic parity and average absolute oods variation throughout the regularization hyperparameter. Image by author

In the experiment, we showed that the most used categorical encoding method in the fair machine learning literature, one-hot encoding, discriminates more in terms of equal opportunity fairness than target encoding. However, target encoding shows promising results. Target encoding using Gaussian regularization show improvements under the presence of both types of biases, with the risk of a noticeable loss of model performance in the case of over-parametrization.

Intersectional Fairness

In the quest for fairness in machine learning, it is essential to recognize the complex interplay of attributes and their impact on discrimination. This section delves into the effects of encoding categorical attributes on intersectional fairness, focusing on insights gained from the COMPAS dataset. We put forth hypotheses concerning the potential degradation of fairness through attribute engineering, the propensity for categorical encoding to increase discrimination, and the efficacy of regularization techniques in mitigating intersectional biases.

To explore the effects of encodings on intersectional fairness, we analyze the concatenated “Ethnic” and “Marital Status” attributes in the COMPAS dataset. By selecting the “Caucasian Married” group as the reference, we compare the maximum fairness violation across all groups. To facilitate comprehension, we utilize the generalized linear model from the previous section and emphasize the Equal Opportunity Fairness metric, which aligns with the behavior of other fairness metrics.

Equal opportunity fairness implications of encoding categorical protected attributes and their regularization effects on the Compas Dataset. Horizontal lines are the base lines where the protected attribute is not included in the training data. Regularized target encoding does not harm fairness metrics but it can improve predictive performance on this dataset. Image by author.

The above figure visually demonstrates how attribute concatenation creates intersectional attributes and exacerbates fairness violations, providing empirical support for our first hypothesis. Remarkably, even when the protected attributes are not encoded (represented by horizontal lines), the maximum fairness violation increases substantially from 0.015 for “Ethnic” or 0.08 for “Marital Status” to 0.16 for the intersectional attribute. This finding substantiates Kimberle Crenshaw’s seminal work in 1958, which shed light on how different forms of oppression intersect and compound discrimination for marginalized groups.

Moreover, our second hypothesis is corroborated by observing that both encoding techniques result in higher equal opportunity violations compared to not encoding the protected attribute. This highlights the role of encoding in amplifying discrimination. However, there is a glimmer of hope: through the regularization of target encoding, fairness can be enhanced. This result aligns with our theoretical understanding, as attribute concatenation can worsen fairness by increasing both irreducible and reducible biases.

Our research highlights the significant role of categorical attribute encoding in balancing model accuracy and fairness in machine learning. We have identified two types of biases, irreducible and reducible, that can arise from encoding categorical attributes.

Through theoretical analysis and empirical experiments, we find that one-hot encoding tends to exhibit more discrimination compared to target encoding. However, promising results are observed with regularized target encoding, which shows potential for improving fairness while maintaining acceptable model performance.

We emphasize the importance of considering the implications of encoding categorical protected attributes, as slight modifications in the encoding approach can lead to fairness improvements without significant sacrifices in predictive accuracy.

Nonetheless, it is essential to acknowledge the limitations of our study and the need for further exploration. Our open-source resources ensure the reproducibility of our results.

In recent years we have seen algorithmic methods aiming to improve fairness in data-driven systems from many perspectives: data collection, pre-processing, in-processing, and post-processing steps. In this work, we have focused on how the encoding of categorical attributes (a common pre-processing step) can reconcile model quality and fairness.

A common underpinning of much of the work in fair ML is the assumption that trade-offs between equity and accuracy may necessitate complex methods or difficult policy choices [Rodolfa et al.]

Since target encoding with regularization is not only easy to perform but also does not require significant changes to the machine learning models, it can be explored in the future as a suitable complementary for in-processing methods in fair machine learning.

We encourage industry practitioners to consider the implications of encoding categorical protected attributes. With slight changes in the encoding approach, improvements in fairness can be achieved without significant detriment to predictive performance. However, it is essential to understand that the usage of fair AI methods does not guarantee the fairness of complex socio-technical systems.

Limitations: This work aims to show what are some of the implications of encoding categorical protected attributes at any moment it should be understood as if in any situation encoding categorical protected attributes won’t increase fairness metrics, we advocate that considering the effects of encoding regularization along the fairness axis too, not only on the predictive performance axis. The usage of fair-AI methods does not necessarily guarantee the fairness of AI-based complex socio-technical systems.

Acknowledgements

This work has received funding from the European Union’s Horizon 2020 research and innovation program under Marie Sklodowska-Curie Actions (grant agreement number 860630) for the project ‘’NoBIAS — Artificial Intelligence without Bias’’

Disclaimer

This work reflects only the authors’ views and the European Research Executive Agency (REA) is not responsible for any use that may be made of the information it contains.

Cite

@inproceedings{fairEncoder,
author = {Mougan, Carlos and Alvarez, Jose M. and Ruggieri, Salvatore and Staab, Steffen},
title = {Fairness Implications of Encoding Protected Categorical Attributes},
year = {2023},
url = {https://arxiv.org/abs/2201.11358},
booktitle = {Proceedings of the 2023 AAAI/ACM Conference on AI, Ethics, and Society},
location = {Montreal, Canada},
series = {AIES '23}
}

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment