Skip to content

Commit

Permalink
Fixed computation of coefficient of variation in classification_metri…
Browse files Browse the repository at this point in the history
…c.py - c_v = sqrt(2*GE(alpha=2))
  • Loading branch information
plankington committed Jan 19, 2022
1 parent 963df2e commit e6d4694
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions aif360/metrics/classification_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,10 @@ def theil_index(self):
return self.generalized_entropy_index(alpha=1)

def coefficient_of_variation(self):
r"""The coefficient of variation is two times the square root of the
r"""The coefficient of variation is the square root of two times the
:meth:`generalized_entropy_index` with :math:`\alpha = 2`.
"""
return 2 * np.sqrt(self.generalized_entropy_index(alpha=2))
return np.sqrt(2*self.generalized_entropy_index(alpha=2))

def between_group_theil_index(self):
r"""The between-group Theil index is the
Expand All @@ -789,11 +789,11 @@ def between_group_theil_index(self):
return self.between_group_generalized_entropy_index(alpha=1)

def between_group_coefficient_of_variation(self):
r"""The between-group coefficient of variation is two times the square
root of the :meth:`between_group_generalized_entropy_index` with
r"""The between-group coefficient of variation is the square
root of two times the :meth:`between_group_generalized_entropy_index` with
:math:`\alpha = 2`.
"""
return 2*np.sqrt(self.between_group_generalized_entropy_index(alpha=2))
return np.sqrt(2*self.between_group_generalized_entropy_index(alpha=2))

def between_all_groups_theil_index(self):
r"""The between-group Theil index is the
Expand All @@ -803,11 +803,11 @@ def between_all_groups_theil_index(self):
return self.between_all_groups_generalized_entropy_index(alpha=1)

def between_all_groups_coefficient_of_variation(self):
r"""The between-group coefficient of variation is two times the square
root of the :meth:`between_all_groups_generalized_entropy_index` with
r"""The between-group coefficient of variation is the square
root of two times the :meth:`between_all_groups_generalized_entropy_index` with
:math:`\alpha = 2`.
"""
return 2 * np.sqrt(self.between_all_groups_generalized_entropy_index(
return np.sqrt(2*self.between_all_groups_generalized_entropy_index(
alpha=2))

def differential_fairness_bias_amplification(self, concentration=1.0):
Expand Down

0 comments on commit e6d4694

Please sign in to comment.