Comments (3)
I also have the same problem.
my data is as follows:
score 0/1
label value 0/1
sex object
race object
age_category object
from aequitas.
Hi
Can you provide a minimal working example?
The following code runs fine for me on the latest aequitas:
import random
import numpy as np
import pandas as pd
n_samples = 1000
df = pd.DataFrame({
'label_value': (np.random.random((n_samples,)) > 0.95).astype(int),
'score': (np.random.random((n_samples,)) > 0.90).astype(int),
'gender': np.array(['M' if random.random() > 0.5 else 'F' for _ in range(n_samples)]),
'race': np.array(['Caucasian' if random.random() > 0.2 else 'Non-Caucasian' for _ in range(n_samples)]),
'age_category': np.array([int(random.random() * 4) for _ in range(n_samples)]).astype(str),
})
df.dtypes
from aequitas.group import Group
from aequitas.bias import Bias
attr_cols = list(set(df.columns) - {
'entity_id', 'score', 'label_value', 'as_of_date'
})
# Initialize aequitas objects
g = Group()
b = Bias()
# Get confusion matrix and metrics for each individual group and attribute
confusion_matrix_metrics, _ = g.get_crosstabs(
df, attr_cols=attr_cols,
)
bdf = b.get_disparity_predefined_groups(
confusion_matrix_metrics, original_df=df,
ref_groups_dict={
'race': 'Caucasian',
'gender': 'M',
'age_category': '1',
},
alpha=0.05, check_significance=True,
mask_significance=False,
)
bdf.style
from aequitas.
AttributeError Traceback (most recent call last)
/opt/anaconda3/envs/test/lib/python3.9/site-packages/altair/vegalite/v4/api.py in ?(self, include, exclude)
1647 # see ipython/ipython#11038
1648 try:
1649 dct = self.to_dict()
1650 except Exception:
-> 1651 utils.display_traceback(in_ipython=True)
1652 return {}
1653 else:
1654 return renderers.get()(dct)
/opt/anaconda3/envs/test/lib/python3.9/site-packages/altair/vegalite/v4/api.py in ?(self, *args, **kwargs)
371
372 try:
373 dct = super(TopLevelMixin, copy).to_dict(*args, **kwargs)
374 except jsonschema.ValidationError:
--> 375 dct = None
376
377 # If we hit an error, then re-convert with validate='deep' to get
378 # a more useful traceback. We don't do this by default because it's
/opt/anaconda3/envs/test/lib/python3.9/site-packages/altair/utils/schemapi.py in ?(self, validate, ignore, context)
321
322 if self._args and not self._kwds:
...
6297 ):
6298 return self[name]
-> 6299 return object.getattribute(self, name)
AttributeError: 'Series' object has no attribute 'iteritems'
from aequitas.
Related Issues (20)
- Add method: Fair Label Noise Correction
- Add Method: Group Thresholding
- Add method: Fairness Through Unawareness
- Update GitHub pages HOT 1
- Unit and Integration Testing HOT 1
- `Audit` class improvements
- Method in `Experiment` to plot the results
- ValueError: Replace has to be set to True when upsampling the population frac > 1 HOT 1
- Better handling of experiment output folders
- Sensitive attribute type check is erroneously expecting object type
- Install fails on python 3.12 HOT 2
- Move included datasets to other place HOT 1
- Enhance Robustness by Handling Missing Values and Group-wise Calculation of PPR
- Enhance summary visual to use more than color
- Update Pass / Fail Labels
- Inconsistent column name for target variable HOT 1
- Attribute Error ap.disparity
- Add type checking at major parts of the code
- Integration with some ML platforms (such as ML Flow or weights and biases)
- Add a readme or page on the existing metrics of fairness HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aequitas.