Giter VIP home page Giter VIP logo

Comments (3)

kalikhademi avatar kalikhademi commented on August 31, 2024

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.

AndreFCruz avatar AndreFCruz commented on August 31, 2024

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.

camyaheltonthomas avatar camyaheltonthomas commented on August 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.