-
Notifications
You must be signed in to change notification settings - Fork 113
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
[Error] get_disparity_predefined_group() raises AttributeError #86
Comments
I also have the same problem. |
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 |
AttributeError Traceback (most recent call last) /opt/anaconda3/envs/test/lib/python3.9/site-packages/altair/vegalite/v4/api.py in ?(self, *args, **kwargs) /opt/anaconda3/envs/test/lib/python3.9/site-packages/altair/utils/schemapi.py in ?(self, validate, ignore, context) AttributeError: 'Series' object has no attribute 'iteritems' |
I try executing the following code:
but it raises an Attribute Error with the following details:
It works if I set
check_significance=False
.My data frame:
Any ideas why this is? I have the up to date Aequitas version this time.
The text was updated successfully, but these errors were encountered: