Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bias and bug fix #63

Merged
merged 47 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d236295
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
0b07e22
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
3ca6ea5
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
639d81e
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
0fd66b5
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
9df5ab5
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
722effb
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
fef8434
Add bias analyzer for tabular data
yangwenz Dec 12, 2022
9482aea
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
1c57013
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
6f9fccd
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
379e67f
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
b9a2717
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
51f724a
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
5d9d457
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
2423e15
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
9bac664
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
6db96be
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
11ad6a6
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
73c18a9
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
aa43be6
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
befc11c
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
41ae228
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
36cb571
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
311192d
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
ebee3c6
Revise the plotly plot
yangwenz Dec 13, 2022
22702e2
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
0c631c6
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
a97434e
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
d4cb531
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
ee60388
Revise the plotly plot
yangwenz Dec 13, 2022
3f408e4
Revise the plotly plot
yangwenz Dec 13, 2022
1b9574f
Revise the prediction function
yangwenz Dec 13, 2022
11d3a27
Revise the prediction function
yangwenz Dec 13, 2022
adaccdc
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
73bd3a8
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
66bfc3f
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
12aa873
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
a07286f
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
b93804c
Add bias analyzer for tabular data
yangwenz Dec 13, 2022
10a6746
Update setup.py
yangwenz Dec 13, 2022
b56f72a
Add bias analyzer for tabular data
yangwenz Dec 14, 2022
a8ad928
Add bias analyzer for tabular data
yangwenz Dec 14, 2022
4846819
Revise the value range
yangwenz Dec 14, 2022
edec180
Fix the kwargs issue
yangwenz Jan 3, 2023
acbf707
Fix the bug
yangwenz Jan 3, 2023
355264c
Fix the bug
yangwenz Jan 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add bias analyzer for tabular data
  • Loading branch information
yangwenz committed Dec 13, 2022
commit 41ae228bac706355aa05a401fa5b9c979a3cab50
4 changes: 2 additions & 2 deletions omnixai/explainers/tabular/agnostic/bias.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def rd(stats, pred_a, pred_b, labels):
"""
Recall difference.
"""
return {label: stats[label]["tpa"] / stats[label]["na"] -
stats[label]["tpb"] / stats[label]["nb"]
return {label: stats[label]["tpa"] / max(stats[label]["na"], 1) -
stats[label]["tpb"] / max(stats[label]["nb"], 1)
for label in labels}

@staticmethod
Expand Down
7 changes: 4 additions & 3 deletions omnixai/tests/explainers/bias/test_bias_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
import unittest
import numpy as np
from omnixai.utils.misc import set_random_seed
from omnixai.explainers.tabular.agnostic.bias import BiasAnalyzer
from omnixai.tests.explainers.tasks import TabularRegression
Expand All @@ -15,7 +16,7 @@ class TestRegressionBias(unittest.TestCase):
def test_classification_metric(self):
set_random_seed()
task = TabularRegression().train_boston()
predict_function = lambda z: task.model.predict_proba(task.transform.transform(z))
predict_function = lambda z: task.model.predict(task.transform.transform(z))

explainer = BiasAnalyzer(
mode="regression",
Expand All @@ -24,8 +25,8 @@ def test_classification_metric(self):
training_targets=task.test_targets
)
explainer.explain(
feature_column="Sex",
feature_value_or_groups="Female"
feature_column="LSTAT",
feature_value_or_threshold=10
)


Expand Down