From 266342c9ca1f7abb65c274af1de698f3721ea52f Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 20 Jun 2024 11:28:46 +0100 Subject: [PATCH 1/3] typos --- sklearn.md | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/sklearn.md b/sklearn.md index e050a35..b0c8d5e 100644 --- a/sklearn.md +++ b/sklearn.md @@ -87,23 +87,19 @@ Evaluate on the test set using Evaluate fairness using standard metrics with: - fpred.evalaute_fairness() - -| | original | updated | -|:--------------------------------------------------------|-----------:|----------:| -| Class Imbalance | 0.172661 | 0.172661 | -| Demographic Parity | 0.154614 | 0.0984474 | -| Disparate Impact | 0.325866 | 0.517006 | -| Maximal Group Difference in Accuracy | 0.111118 | 0.102622 | -| Maximal Group Difference in Recall | 0.146103 | 0.0195962 | -| Maximal Group Difference in Conditional Acceptance Rate | 0.411181 | 0.255626 | -| Maximal Group Difference in Acceptance Rate | 0.03979 | 0.144976 | -| Maximal Group Difference in Specificity | 0.07428 | 0.033638 | -| Maximal Group Difference in Conditional Rejectance Rate | 0.0351948 | 0.0964846 | -| Maximal Group Difference in Rejection Rate | 0.101413 | 0.120799 | -| Treatment Equality | 0.172428 | 0.28022 | -| Generalized Entropy | 0.102481 | 0.105529 | - -Call `fpredict.predict( )`, and `fpredict.predict_proba( )` to score new data. + fpred.evaluate_fairness() + +| | original | updated | +|:------------------------------------------------|-----------:|-----------:| +| Statistical Parity | 0.157001 | 0.0783781 | +| Predictive Parity | 0.0182043 | 0.092402 | +| Equal Opportunity | 0.170043 | 0.00632223 | +| Average Group Difference in False Negative Rate | 0.170043 | 0.00632223 | +| Equalized Odds | 0.126215 | 0.0170495 | +| Conditional Use Accuracy | 0.0526152 | 0.104521 | +| Average Group Difference in Accuracy | 0.10703 | 0.104349 | +| Treatment Equality | 0.294522 | 0.131856 | + +Call `fpredict.predict()`, and `fpredict.predict_proba()` to score new data. Once the base predictor has been trained, and the object built, you can use the fair predictor in the same way as with autogluon. See [README.md](./README.md) for details. From 657cddca4ea4d0fc0e83f1c128f8848b4395336a Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 20 Jun 2024 16:41:32 +0100 Subject: [PATCH 2/3] remove autogenerated file --- .gitignore | 5 ++++- src/oxonfair/version.py | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 src/oxonfair/version.py diff --git a/.gitignore b/.gitignore index fa7d2e4..3630e88 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ share/python-wheels/ *.egg MANIFEST + # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. @@ -134,4 +135,6 @@ dmypy.json .vscode/ #Mac Preview -.DS_Store \ No newline at end of file +.DS_Store +src/oxonfair/version.py +src/oxonfair/version.py diff --git a/src/oxonfair/version.py b/src/oxonfair/version.py deleted file mode 100644 index 0cfbb69..0000000 --- a/src/oxonfair/version.py +++ /dev/null @@ -1,2 +0,0 @@ -"""This is the oxonfair version file.""" -__version__ = '0.2' From b90830e1566edfbbd15a26a5417b527d19dc6c9c Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 20 Jun 2024 17:27:17 +0100 Subject: [PATCH 3/3] improve test stability --- tests/unittests/test_callable.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unittests/test_callable.py b/tests/unittests/test_callable.py index e44ba60..2c5aea5 100644 --- a/tests/unittests/test_callable.py +++ b/tests/unittests/test_callable.py @@ -27,9 +27,9 @@ def square_align(array): def test_runs(use_fast=True): fpred = oxonfair.FairPredictor(sigmoid, val_dict, val_groups, inferred_groups=square_align, use_fast=use_fast) - fpred.fit(gm.accuracy, gm.equal_opportunity, 0.002) + fpred.fit(gm.accuracy, gm.equal_opportunity, 0.005) tmp = np.asarray(fpred.evaluate(metrics={'eo': gm.equal_opportunity}))[0, 1] - assert tmp < 0.002 + assert tmp < 0.005 fpred.plot_frontier() fpred.plot_frontier(test_dict) fpred.evaluate() @@ -50,9 +50,9 @@ def test_runs_hybrid(): def test_fairdeep(use_fast=True, use_true_groups=False): fpred = oxonfair.DeepFairPredictor(val_target, val, val_groups, use_fast=use_fast, use_actual_groups=use_true_groups) - fpred.fit(gm.accuracy, gm.equal_opportunity, 0.002) + fpred.fit(gm.accuracy, gm.equal_opportunity, 0.005) tmp = np.asarray(fpred.evaluate(metrics={'eo': gm.equal_opportunity}))[0, 1] - assert tmp < 0.002 + assert tmp < 0.005 fpred.plot_frontier() fpred.plot_frontier(test_dict) fpred.evaluate()