【问题标题】:DataFrame object is not callable with AIF360DataFrame 对象不可使用 AIF360 调用
【发布时间】:2021-07-15 18:28:54
【问题描述】:

我遇到 TypeError: 'DataFrame' object is not callable with the following。任何人都可以帮忙吗?谢谢。

%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

【问题讨论】:

    标签: dataframe object callable aif360


    【解决方案1】:

    看来df_data_1 是您的数据集数据框,对吧?如果是,您需要更新脚本以将其转换为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
                                  ) 
    

    我不确定您的数据集是什么样子,但您可以调整完整的可重现示例 here 来为您的数据集执行此过程。

    【讨论】:

      猜你喜欢
      • 2021-08-23
      • 2018-01-08
      • 2017-06-17
      • 1970-01-01
      • 1970-01-01
      • 2014-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多