Skip to content

Commit af1ef4f

Browse files
committed
remove some tests
1 parent b95e31d commit af1ef4f

File tree

1 file changed

+1
-57
lines changed

1 file changed

+1
-57
lines changed

tests/metrics/test_fairness.py

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -243,46 +243,6 @@ def test_dir_equal_favorable_rates(self):
243243
score = DisparateImpactRatio.calculate(privileged=privileged, unprivileged=unprivileged, favorable_output=1)
244244
assert score == approx(1.0, abs=1e-5), f"DIR should be ~1 when rates are equal. Actual score: {score}"
245245

246-
def test_dir_reciprocal(self):
247-
"""Test to verify that swapping privileged and unprivileged grops
248-
in DIR calculation yields the rediprocal of the original calculation."""
249-
df = pd.DataFrame(generate_data())
250-
privileged, unprivileged = get_privileged_unprivileged_split(df)
251-
252-
initial_score = DisparateImpactRatio.calculate(
253-
privileged=privileged, unprivileged=unprivileged, favorable_output=1
254-
)
255-
256-
# Swap privileged and unprivileged groups
257-
swapped_score = DisparateImpactRatio.calculate(
258-
privileged=unprivileged, unprivileged=privileged, favorable_output=1
259-
)
260-
261-
assert swapped_score == approx(1 / initial_score, rel=1e-5), (
262-
f"Swapping privileged and unprivileged DIR should be the reciprocal"
263-
f" of the original DIR. Actual score: {swapped_score}"
264-
)
265-
266-
def test_dir_monotonicity(self):
267-
"""Tests that checks that the DIR value increases as the selection rate increases for the unprivileged group."""
268-
df = pd.DataFrame(generate_data())
269-
privileged, unprivileged = get_privileged_unprivileged_split(df)
270-
271-
initial_score = DisparateImpactRatio.calculate(
272-
privileged=privileged, unprivileged=unprivileged, favorable_output=1
273-
)
274-
275-
unprivileged_modified = increase_selection_rate(unprivileged)
276-
277-
new_score = DisparateImpactRatio.calculate(
278-
privileged=privileged, unprivileged=unprivileged_modified, favorable_output=1
279-
)
280-
281-
assert new_score > initial_score, (
282-
f"DIR should not decrease when unprivileged selection rate increases."
283-
f" Initial DIR: {initial_score}, new DIR: {new_score}"
284-
)
285-
286246
def test_dir_empty_dataframe(self):
287247
"""Test that DIR calculation handles an empty DataFrame correctly."""
288248
empty_df = pd.DataFrame(columns=df.columns)
@@ -327,23 +287,7 @@ def test_spd_zero_when_equal_rates(self):
327287
score = GroupStatisticalParityDifference.calculate(
328288
privileged=privileged, unprivileged=unprivileged, favorable_output=1
329289
)
330-
assert score == approx(0, abs=1e-2), f"SPD should be close to zero when rates are equal. Actual score: {score}"
331-
332-
def test_spd_swap_groups(self):
333-
"""Test that swapping privileged and unprivileged groups yields the negative of the original SPD."""
334-
df = pd.DataFrame(generate_data())
335-
336-
privileged, unprivileged = get_privileged_unprivileged_split(df=df)
337-
initial_score = GroupStatisticalParityDifference.calculate(
338-
privileged=privileged, unprivileged=unprivileged, favorable_output=1
339-
)
340-
swapped_score = GroupStatisticalParityDifference.calculate(
341-
privileged=unprivileged, unprivileged=privileged, favorable_output=1
342-
)
343-
assert swapped_score == approx(-initial_score, abs=1e-5), (
344-
f"Swapping groups should yield the negative SPD."
345-
f" Initial score: {initial_score}, swapped score: {swapped_score}"
346-
)
290+
assert score == approx(0, abs=1e-2), f"SPD should be ~0 when rates are equal. Actual score: {score}"
347291

348292
def test_spd_sign(self):
349293
"""Tests that the sign of SPD correctly indicates which group has a higher favorable outcome rate."""

0 commit comments

Comments
 (0)