Hoshihl
Hoshihl

Reputation: 1

DataFrame object is not callable with AIF360

I encounter TypeError: 'DataFrame' object is not callable with the following. Anyone can help? Thanks.

%cd -
dataset_orig = df_data_1(protected_attribute_names=['Gender'],
privileged_classes=['Male'],      
features_to_drop=[]) 

dataset_orig_train, dataset_orig_test = dataset_orig.split([0.7], shuffle=True)

privileged_groups = [{'Gender': 1}]
unprivileged_groups = [{'Gender': 0}]

/home/wsuser/work

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-59-8c624cfec261> in <module>
      5 # consider in this evaluation
      6 privileged_classes=['Male'],      # male is considered privileged
----> 7 features_to_drop=[]) # ignore all other attributes
      8 
      9 dataset_orig_train, dataset_orig_test = dataset_orig.split([0.7], shuffle=True)

TypeError: 'DataFrame' object is not callable

Upvotes: 0

Views: 967

Answers (1)

Reveille
Reveille

Reputation: 4629

It appears that df_data_1 is your dataset dataframe, right? If it is, you would need to update your script to convert it to StandardDataset:

from aif360.datasets import StandardDataset

dataset_orig = StandardDataset(df_data_1, 
                               protected_attribute_names=['Gender'],
                               privileged_classes=['Male'],
                               features_to_drop=[],
                               favorable_classes=[1]  # Update this with label values which are considered favorable in your dataset
                              ) 

I am not sure how your dataset looks like, but you can adapt the complete reproducible example here to do this process for your dataset.

Upvotes: 0

Related Questions