Equidad y corrección de sesgos en Aprendizaje Automático

De FdIwiki ELP
Saltar a: navegación, buscar

Versión en inglés: Fairness and bias correction in Machine Learning

En aprendizaje automático, un algoritmo es justo, o tiene equidad si sus resultados son independientes de un cierto conjunto de variables que consideramos sensibles y no relacionadas con él (p.e.: género, raza, orientación sexual, etc.).

Fairness criteria in classification problems[1]

In classification problems, an algorithm learns a function to predict a discrete characteristic Y.JPG, the target variable, from known characteristics X.JPG. We model A.JPG as a discrete random variable which encodes some characteristics contained or implictly encoded in X.JPG that we consider as sensitive characteristics (gender, ethnicity, sexuality, etc.). We finally denote by R.JPG the prediction of the classifier. Now let us define three main criteria to evaluate if a given classifier is fair, that is, if its predictions are not influenced by some of this sensitive variables.

Independence

We say the random variables R,A.JPG satisfy independence if the sensitive characteristics A.JPG are statistically independent to the prediction R.JPG, and we write RbotA.JPG.

We can also express this notion with the following formula:

IndependenceDef.JPG

This means that the probability of being classified by the algorithm in each of the groups is equal for two individuals with different sensitive characteristics.

Yet another equivalent expression for equivalence can be given using the concept of mutual information between random variables, defined as

MutInf.JPG

In this formula, H.JPG is the entropy of the random variable. Then R,A.JPG satisfy independence if I(R,A).JPG.

A possible relaxation of the indepence definition include introducing a positive slack EpsMq0.JPG and is given by the formula:

IndependenceRel1.JPG

Finally, another possible relaxation is to require IndependenceRel2.JPG.

Separation

We say the random variables R,A,Y.JPG satisfy separation if the sensitive characteristics A.JPG are statistically independent to the prediction R.JPG given the target value Y.JPG, and we write RbotAbarY.JPG.

We can also express this notion with the following formula:

SeparationDef.JPG

This means that the probability of being classified by the algorithm in each of the groups is equal for two individuals with different sensitive characteristics given that they actually belong in the same group (have the same target variable).

Another equivalent expression, in the case of a binary target rate, is that the true positive rate and the false positive rate are equal (and therefore the false negative rate and the true negative rate are equal) for every value of the sensitive characteristics:

SeparationDef1.JPG
SeparationDef2.JPG

Finally, a possible relaxation of the given definitions is the difference between rates to be a positive number lower than a given slack EpsMq0.JPG, instead of equals to zero.

Sufficiency

We say the random variables R,A,Y.JPG satisfy sufficiency if the sensitive characteristics A.JPG are statistically independent to the target value Y.JPG given the prediction R.JPG, and we write YbotAbarR.JPG.

We can also express this notion with the following formula:

SufficiencyDef.JPG

This means that the probability of actually being in each of the groups is equal for two individuals with different sensitive characteristics given that they were predicted to belong to the same group.

Relationships between definitions

Finally, we sum up some of the main results that relate the three definitions given above:

Métricas[2]

La mayoría de medidas de equidad dependen de diferentes métricas, de modo que comenzaremos por definirlas. Cuando trabajamos con un clasificador binario, tanto la clase predicha por el algoritmo como la real pueden tomar dos valores: positivo y negativo. Empecemos ahora explicando las posibles relaciones entre el resultado predicho y el real:
Matriz de confusión
  • Verdadero positivo (TP): Cuando el resultado predicho y el real pertenecen a la clase positiva.
  • Verdadero negativo (TN): Cuando el resultado predicho y el real pertenecen a la clase negativa.
  • Falso positivo (FP): Cuando el resultado predicho es positivo pero el real pertenece a la clase negativa.
  • Falso negativo (FN): Cuando el resultado predicho es negativo pero el real pertenece a la clase positiva.

Estas relaciones pueden ser representadas fácilmente con una matriz de confusión, una tabla que describe la precisión de un modelo de clasificación. En esta matriz, las columnas y las filas representan instancias de las clases predichas y reales, respectivamente.

Utilizando estas relaciones, podemos definir múltiples métricas que podemos usar después para medir la equidad de un algoritmo:

  • Valor predicho positivo (PPV): la fracción de casos positivos que han sido predichos correctamente de entre todas las predicciones positivas. Con frecuencia, se denomina como precisión, y representa la probabilidad de que una predicción positiva sea correcta. Viene dada por la siguiente fórmula:
PPV.JPG
  • Tasa de descubrimiento de falsos (FDR): la fracción de predicciones positivas que eran en realidad negativas de entre todas las predicciones positivas. Representa la probabilidad de que una predicción positiva sea errónea, y viene dada por la siguiente fórmula:
FDR.JPG
  • Valor predicho negativo (NPV): la fracción de casos negativos que han sido predichos correctamente de entre todas las predicciones negativas. Representa la probabilidad de que una predicción negativa sea correcta, y viene dada por la siguiente fórmula:
NPV.JPG
  • Tasa de omisión de falsos (FOR): la fracción de predicciones negativas que eran en realidad positivas de entre todas las predicciones negativas. Representa la probabilidad de que una predicción negativa sea errónea, y viene dada por la siguiente fórmula:
FOR.JPG
  • Tasa de verdaderos positivos (TPR): la fracción de casos positivos que han sido predichos correctamente de entre todos los casos positivos. Con frecuencia, se denomina como exhaustividad, y representa la probabilidad de que los sujetos positivos sean clasificados correctamente como tales. Viene dada por la fórmula:
TPR.JPG
  • Tasa de falsos negativos (FNR): la fracción de casos positivos que han sido predichos de forma errónea como negativos de entre todos los casos positivos. Representa la probabilidad de que los sujetos positivos sean clasificados erróneamente como negativos, y viene dada por la fórmula:
FNR.JPG
  • Tasa de verdaderos negativos (TNR): la fracción de casos negativos que han sido predichos correctamente de entre todos los casos negativos. Representa la probabilidad de que los sujetos negativos sean clasificados correctamente como tales, y viene dada por la fórmula:
TNR.JPG
  • Tasa de falsos positivos (FPR): la fracción de casos negativos que han sido predichos de forma errónea como positivos de entre todos los casos negativos. Representa la probabilidad de que los sujetos negativos sean clasificados erróneamente como positivos, y viene dada por la fórmula:
FPR.JPG

Other fairness criteria

Relationship between fairnes criteria as shown in Barocas et al.[1]

The following criteria can be understood as measures of the three definitions given on the first section, or a relaxation of them. In the table[1] to the right we can see the relationships between them.

To define this measures specifically, we will divide them into three big groups as done in Verma et al.[2]: definitions based on predicted outcome, on predicted and actual outcomes, and definitions based on predicted probabilities and actual outcome.

We will be working with a binary classifier and the folowing notation: S.JPG refers to the score given by the classifier, which is the probability of a certain subject to be in the positive or the negative class. R.JPG represents the final classification predicted by the algorithm, and its value is usually derived from S.JPG, for example will be positive when S.JPG is above a certain threshold. Y.JPG represents the actual outcome, that is, the real classification of the individual and, finally, A.JPG denotes the sensitive attributes of the subjects.

Definitions based on predicted outcome

The definitions in this section focus on a predicted outcome R.JPG for various distributions of subjects. They are the simplest and most intuitive notions of fairness.

  • Group fairness, also referred to as statistical parity, demographic parity, acceptance rate and benchmarking. A classifier satisfies this definition if the subjects in the protected and unprotected groups have equal probability of being assigned to the positive predicted class. This is, if the following formula is satisfied:
Group fairness.JPG
  • Conditional statistical parity. Basically consists in the definition above, but restricted only to a subset of the attributes. With mathematical notation this would be:
Definitions1.JPG

Definitions based on predicted and actual outcomes

This definitions not only consider de predicted outcome R.JPG but also compare it to the actual outcome Y.JPG.

  • Predictive parity, also referred to as outcome test. A classifier satisfies this definition if the subjects in the protected and unprotected groups have equal PPV. This is, if the following formula is satisfied:
Predictive parity.JPG
Mathematically, if a classifier has equal PPV for both groups, it will also have equal FDR, satisfying the formula:
Predictive parity2.JPG
  • False positive error rate balance, also referred to as predictive equality. A classifier satisfies this definition if the subjects in the protected and unprotected groups have aqual FPR. This is, if the following formula is satisfied:
Predictive equality.JPG
Mathematically, if a classifier has equal FPR for both groups, it will also have equal TNR, satisfying the formula:
Predictive equality2.JPG
  • False negative error rate balance, also referred to as equal opportunity. A classifier satisfies this definition if the subjects in the protected and unprotected groups have equal FNR. This is, if the following formula is satisfied:
Equal opportunity.JPG
Mathematically, if a classifier has equal FNR for both groups, ti will also have equal TPR, satisfying the formula:
Equal opportunity2.JPG
  • Equalized odds, also referred to as conditional procedure accuracy equality and disparate mistreatment. A classifier satisfies this definition if the subjects in the protected and unprotected groups have equal TPR and equal FPR, satisfying the formula:
Equalized odds.JPG
  • Conditional use accuracy equality. A classifier satisfies this definition if the subjects in the protected and unprotected groups have equal PPV and equal NPV, satisfying the formula:
Conditional.JPG
  • Overall accuracy equality. A classifier satisfies this definition if the subject in the protected and unprotected groups have equal prediction accuracy, that is, the probability of a subject from one class to be assigned to it. This is, if it satisfies the following formula:
Overall.JPG
  • Treatment equality. A classifier satisfies this definition if the subjects in the protected and unprotected groups have an equal ratio of FN and FP, satisfying the formula:
Treatment.JPG

Definitions based on predicted probabilities and actual outcome

These definitions are based in the actual outcome Y.JPG and the predicted probability score S.JPG.

  • Test-fairness, also known as calibration or matching conditional frequencies. A classifier satisfies this definition if individuals with the same predicted probability score S.JPG have the same probability to be classified in the positive class when they belong to either the protected or the unprotected group:
Definitions2.JPG
  • Well-calibration. It's an extension of the previous definition. It states that when individuals inside or outside the protected group have the same predicted probability score S.JPG they must have the same probability of being classified in the positive class, and this probability must be equal to S.JPG:
Definitions3.JPG
  • Balance for positive class. A classifier satisfies this definition if the subjects constituting the positive class from both protected and unprotected groups have equal average predicted probability score S.JPG. This means that the expected value of probability score for the protected and unprotected groups with positive actual outcome Y.JPG is the same, satisfying the formula:
Balance positive.JPG
  • Balance for negative class. A classifier satisfies this definition if the subjects constituting the negative class from both protected and unprotected groups have equal average predicted probability score S.JPG. This means that the expected value of probability score for the protected and unprotected groups with negative actual outcome Y.JPG is the same, satisfying the formula:
Balance negative.JPG

Algoritmos

Se puede aplicar la equidad al aprendizaje automático desde tres perspectivas: pre-procesando los datos utilizados en el algoritmo, optimizando los objetivos durante el entrenamiento o procesando las respuestas tras la ejecución del algoritmo.

Preprocesamiento

Los algoritmos que corrigen el sesgo mediante preprocesamiento intentan eliminar información sobre ciertos atributos de los datos que pueden provocar un comportamiento injusto de la IA, al mismo tiempo que tratan de alterar estos datos lo menos posible. Eliminar del conjunto de datos una variable protegida no es suficiente, ya que otras variables pueden estar correlacionadas con ella.

Una posible forma de hacerlo consiste en asociar cada individuo del conjunto de datos a una representación intermedia en la que sea imposible determinar si pertenece o no a un grupo protegido, a la vez que se mantiene el resto de la información tanto como sea posible. Después, se ajusta la nueva representación del conjunto de datos para buscando el máximo acierto del algoritmo.

De este modo, los individuos se vinculan a una nueva representación en la que la probabilidad de que un miembro de un grupo protegido sea asociado a cierto valor de la nueva representación es la misma que la de un individuo no protegido. Así, es la nueva representación la que se utiliza para obtener la predicción para el individuo en vez de los datos originales. Como la representación intermedia se ha construido dando la misma probabilidad a cada individuo independientemente de si pertenecen al grupo protegido o no, esto queda oculto para el clasificador.

Se puede encontrar un ejemplo en Zemel y otros [3] en el que se utiliza una variable aleatoria multinomial como representación intermedia. En el proceso, se preserva toda la información excepto la que pueda conducir a decisiones sesgadas a la vez que se busca una predicción lo más correcta que sea posible.

Por un lado, este procedimiento tiene la ventaja de que los datos preprocesados se pueden utilizar para cualquier tarea de aprendizaje automático. Además, no hay que modificar el código del clasificador, ya que la corrección se aplica a los datos que se van a introducir en él. Por otro lado, los otros métodos obtienen mejores resultados tanto en acierto como en equidad. [4]

Reweighing [5]

Reweighing is an example of preprocessing algorithm. The idea is to assign a weight to each dataset point such that the weighted discrimination is 0 with respect to the designated group.

If the dataset D.jpg was unbiased the sensitive variable A.JPG and the target variable Y.JPG would be statistically independent and the probability of the joint distribution would be the product of the probabilities as follows:

Fairness formula 1.JPG

In reality, however, the dataset is not unbiased and the variables are not statistically independent so the observed probability is:

Fairness formula 2.JPG

To compensate for the bias, lower weights to favored objects and higher weights to unfavored objects will be assigned. For each X D.JPG we get:

Fairness formula 3.JPG

When we have for each X.JPG a weight associated we compute the weighted discrimination with respect to group framelesss as follows:

Fairness formula 4.JPG

It can be shown that after reweighting this weighted discrimination is 0.

Optimización durante el entrenamiento

Otra aproximación al problema es corregir el sesgo durante el entrenamiento. Esto puede hacerse añadiendo restricciones al objetivo del algoritmo.[6] Estas restricciones obligan al algoritmo a tener en cuenta la equidad, de forma que el máximo éxito no sea su único objetivo, sino también mantener ciertas métricas iguales tanto para el grupo protegido como para el resto de individuos. Por ejemplo, se puede añadir al algoritmo la condición de que la tasa de falsos positivos sea la misma para individuos del grupo protegido y para los que no lo son.

Las principales métricas que se utilizan en esta técnica son la tasa de falsos positivos, la tasa de falsos negativos y la tasa general de fallo. Es posible añadir sólo una o varias de estas restricciones al objetivo. Nótese que la igualdad de las tasas de falsos negativos implica la igualdad también de las tasas de verdaderos positivos, lo que significa igualdad de oportunidad. Tras añadir las restricciones al algoritmo, el problema puede volverse infactible y por tanto puede ser necesario relajarlas.

Esta técnica obtiene buenos resultados al mejorar la equidad, al mismo tiempo que mantiene una exactitud alta, y permite al programador elegir las métricas que mejor se ajusten a sus necesidades. Sin embargo, la técnica y las métricas utilizadas varían en función del problema y es necesario modificar el código del algoritmo, lo que no siempre es posible.[4]

Adversarial debiasing [7] [8]

Interaction between "predictor" and "adversarial" as shown by Joyce Xu [8]

We train two classifiers at the same time through some gradient-based method (f.e.: gradient descent). The first one, the "predictor" tries to accomplish the task of predicting Y.JPG, the target variable, given X.JPG, the input, by modifying its weights W.JPG to minimize some loss function Lpyy.JPG. The second one, the "adversary" tries to accomplish the task of predicting A.JPG, the sensitive variable, given Ygorro.JPG by modifying its weights U.JPG to minimize some loss function Lpzz.JPG.

An important point here is that, in order to propagate correctly, Ygorro.JPG above must refer to the raw output of the classifier, not the discrete prediction; for example, with an artificial neural network and a classification problem, Ygorro.JPG could refer to the output of the softmax layer.

Then we update U.JPG to minimize LA.JPG at each training step according to the gradient Grad ula.JPG and we modify W.JPG according to the expression:

Fairness formula 5.JPG

where Alpha.JPG is a tuneable hyperparameter that can vary at each time step.

Graphic representation of the vectors used in adversarial debiasing as shown in Zhan et al.[7]

The intuitive idea is that we want the "predictor" to try to minimize LP.JPG (therefore the term Grad wlp.JPG) while, at the same time, maximize LA.JPG (therefore the term Alfa grad wla.JPG), so that the "adversary" fails at predicting the sensitive variable from Ygorro.JPG.

The term Fairness formula 6.JPG prevents the "predictor" from moving in a direction that helps the "adversary" decrease its loss function.

It can be shown that training a classification model "predictor" with this algorithm decreases demographic parity with respect to training it without the "adversary".

Post-procesamiento

La última técnica trata de corregir las respuestas del clasificador para alcanzar la equidad. En éste método, necesitamos hacer una predicción binaria para los individuos y tenemos un clasificador que devuelve una puntuación asociada a cada uno de ellos. Los individuos con puntuaciones altas tenderán a obtener una respuesta positiva, mientras que aquellos con una puntuación baja tendrán una respuesta negativa, pero necesitamos determinar el umbral a partir del cual se responde positiva o negativamente. Nótese que variar el umbral afecta al compromiso entre la tasa de verdaderos positivos y la tasa de verdaderos negativos, y en función del problema nos puede interesar mejorar una a costa de la otra.

Si la función de puntuación es justa, en el sentido de que es independiente del atributo protegido, entonces cualquier elección del valor umbral será también justa, pero este tipo de clasificadores tienden a sesgarse con facilidad, por lo que puede que necesitemos especificar un umbral distinto para cada grupo protegido. Una forma de hacerlo es estudiar las gráficas de la tasa de verdaderos positivos frente a la de verdaderos negativos para distintos valores del umbral (a esto se le conoce como curva ROC) y comprobar para qué valor del umbral las tasas son iguales para el grupo protegido y para el resto de individuos.[9]

Entre las ventajas del post-procesamiento están que la técnica se puede aplicar después de usar cualquier clasificador, sin necesidad de modificarlo, y obtiene buenos resultados mejorando métricas de equidad. Entre los inconvenientes, es necesario consultar el valor del atributo protegido durante el post-procesamiento y se restringe la libertad del programador para regular el compromiso entre equidad y exactitud.[4]

Reject Option based Classification (ROC) [10]

Given a classifier let Roc formula 1.JPG be the probability computed by the classifiers as the probability that the instance X.JPG belongs to the positive class +. When Roc formula 1.JPG is close to 1 or to 0, the instance X.JPG is specified with high degree of certainty to belong to class + or - respectively. However, when Roc formula 1.JPG is closer to 0.5 the classification is more unclear.

We say X.JPG is a "rejected instance" if Roc formula 2.JPG with a certain Theta.JPG such that Roc formula 3.JPG.

The algorithm of "ROC" consists on classifying the non rejected instances following the rule above and the rejected instances as follows: if the instance is an example of a deprived group ( Roc formula 3.JPG) then label it as positive, otherwise label it as negative.

We can optimize different measures of discrimination as functions of Theta.JPG to find the optimal Theta.JPG for each problem and avoid becoming discriminatory against the privileged group.

References

  1. 1,0 1,1 1,2 Solon Barocas; Moritz Hardt; Arvind Narayanan, Fairness and Machine Learning. Retrieved 15 December 2019.
  2. 2,0 2,1 Sahil Verma; Julia Rubin, Fairness Definitions Explained. Consultado 15 December 2019
  3. Richard Zemel; Yu (Ledell) Wu; Kevin Swersky; Toniann Pitassi; Cyntia Dwork, Learning Fair Representations. Consultado el 1 de Diciembre de 2019
  4. 4,0 4,1 4,2 Ziyuan Zhong, Tutorial on Fairness in Machine Learning. Consultado el 1 de Diciembre de 2019
  5. Faisal Kamiran; Toon Calders, Data preprocessing techniques for classification without discrimination. Retrieved 17 December 2019
  6. Muhammad Bilal Zafar; Isabel Valera; Manuel Gómez Rodríguez; Krishna P. Gummadi, Fairness Beyond Disparate Treatment & Disparate Impact: Learning Classification without Disparate Mistreatment. Consultado el 1 de Diciembre de 2019
  7. 7,0 7,1 Brian Hu Zhang; Blake Lemoine; Margaret Mitchell, Mitigating Unwanted Biases with Adversarial Learning. Retrieved 17 December 2019
  8. 8,0 8,1 Joyce Xu, Algorithmic Solutions to Algorithmic Bias: A Technical Guide. Retrieved 17 December 2019
  9. Moritz Hardt; Eric Price; Nathan Srebro, Equality of Opportunity in Supervised Learning. Retrieved 1 December 2019
  10. Faisal Kamiran; Asim Karim; Xiangliang Zhang, Decision Theory for Discrimination-aware Classification. Retrieved 17 December 2019