Skip to content

Commit

Permalink
Merge pull request #25 from fidelity/test_fix
Browse files Browse the repository at this point in the history
update
  • Loading branch information
skadio authored Sep 7, 2023
2 parents 4e59100 + ffb37a9 commit fa968bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jurity/fairness/for_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

from jurity.fairness.base import _BaseBinaryFairness
from jurity.utils import check_and_convert_list_types
from jurity.utils import check_inputs_validity
from jurity.utils import check_inputs
from jurity.utils import performance_measures
from jurity.utils import split_array_based_on_membership_label


class FORDifference(_BaseBinaryFairness):

def __init__(self):
Expand All @@ -26,7 +27,7 @@ def __init__(self):
@staticmethod
def get_score(labels: Union[List, np.ndarray, pd.Series],
predictions: Union[List, np.ndarray, pd.Series],
is_member: Union[List, np.ndarray, pd.Series],
memberships: Union[List, np.ndarray, pd.Series],
membership_label: Union[str, float, int] = 1) -> float:
"""
The equality (or lack thereof) of the false omission rates across groups is an important fairness metric.
Expand All @@ -43,7 +44,7 @@ def get_score(labels: Union[List, np.ndarray, pd.Series],
Binary ground truth labels for the provided dataset (0/1).
predictions: Union[List, np.ndarray, pd.Series]
Binary predictions from some black-box classifier (0/1).
is_member: Union[List, np.ndarray, pd.Series]
memberships: Union[List, np.ndarray, pd.Series]
Binary membership labels (0/1).
membership_label: Union[str, float, int]
Value indicating group membership.
Expand All @@ -54,10 +55,11 @@ def get_score(labels: Union[List, np.ndarray, pd.Series],
False Omission Rate difference between groups.
"""
# Logic to check input types.
check_inputs_validity(labels=labels, predictions=predictions, is_member=is_member, optional_labels=False)
check_inputs(predictions=predictions, memberships=memberships, membership_labels=membership_label,
must_have_labels=True, labels=labels)

# List needs to be converted to np for indexing
is_member = check_and_convert_list_types(is_member)
is_member = check_and_convert_list_types(memberships)
predictions = check_and_convert_list_types(predictions)
labels = check_and_convert_list_types(labels)

Expand Down

0 comments on commit fa968bc

Please sign in to comment.