Skip to content

Conversation

eustomaqua
Copy link

I found two issues when I was using AdaFair:

  1. ZeroDivisionError: division by zero may happen if the denominator is zero, such as
		tpr_protected = tp_protected / (tp_protected + fn_protected)
		tnr_protected = tn_protected / (tn_protected + fp_protected)

		tpr_non_protected = tp_non_protected / (tp_non_protected + fn_non_protected)
		tnr_non_protected = tn_non_protected / (tn_non_protected + fp_non_protected)
		alpha = 1 * (
				np.log((1. - estimator_error) / estimator_error) +
				np.log(n_classes - 1.))
			TPR = (float(tp)) / (tp + fn)
			TNR = (float(tn)) / (tn + fp)
			cumulative_balanced_error = 1 - (TPR + TNR) / 2
			cumulative_error = 1 - (float(tp) + float(tn)) / (tp + tn + fp + fn)
  1. AdaFair only works for the situation where only one sensitive attribute is considered and that attribute has binary values (such as {0,1})

So I made two modifications for these two issues, alongside relevant lines using them

  1. the check_zero function between line 42 and line 43
  2. the _member_found function between line 331 and line 334
    Note that the _member_found function makes AdaFair suitable for situations where one sensitive attribute has multiple values (such as {0,1,2,3}), instead of only two optional values like {0,1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant